Class: IsoDoc::Csd::PdfConvert
- Inherits:
-
XslfoPdfConvert
- Object
- XslfoPdfConvert
- IsoDoc::Csd::PdfConvert
- Defined in:
- lib/isodoc/csd/pdf_convert.rb
Overview
A Converter implementation that generates CSD output, and a document schema encapsulation of the document for validation
Instance Method Summary collapse
- #convert(filename, file = nil, debug = false) ⇒ Object
-
#initialize(options) ⇒ PdfConvert
constructor
A new instance of PdfConvert.
Constructor Details
#initialize(options) ⇒ PdfConvert
Returns a new instance of PdfConvert.
9 10 11 12 |
# File 'lib/isodoc/csd/pdf_convert.rb', line 9 def initialize() @libdir = File.dirname(__FILE__) super end |
Instance Method Details
#convert(filename, file = nil, debug = false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/isodoc/csd/pdf_convert.rb', line 14 def convert(filename, file = nil, debug = false) file = File.read(filename, encoding: "utf-8") if file.nil? docxml, outname_html, dir = convert_init(file, filename, debug) /\.xml$/.match(filename) or filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f| f.write file f.path end FileUtils.rm_rf dir ::Metanorma::Output::XslfoPdf.new.convert( filename, outname_html + ".pdf", File.join(@libdir, "csd.standard.xsl")) end |