Sha256: f2ebcc9cc6201d72ef493dbcb1a8c4d6a3510f30c57b0ce325ce2c59b708f655

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

require_relative "base_convert"
require "isodoc"

module IsoDoc
  module M3d

    # A {Converter} implementation that generates HTML output, and a document
    # schema encapsulation of the document for validation
    #
    class PdfConvert < IsoDoc::XslfoPdfConvert
      def initialize(options)
        @libdir = File.dirname(__FILE__)
        super
      end

      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, "m3d.report.xsl"))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metanorma-m3d-1.3.22 lib/isodoc/m3d/pdf_convert.rb
metanorma-m3d-1.3.21 lib/isodoc/m3d/pdf_convert.rb