class IsoDoc::Rsd::PdfConvert

A {Converter} implementation that generates PDF HTML output, and a document schema encapsulation of the document for validation

Public Class Methods

new(options) click to toggle source
Calls superclass method
# File lib/isodoc/rsd/pdf_convert.rb, line 9
def initialize(options)
  @libdir = File.dirname(__FILE__)
  super
end

Public Instance Methods

convert(filename, file = nil, debug = false) click to toggle source
# File lib/isodoc/rsd/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, "rsd.standard.xsl"))
end