Sha256: 1ad6b2c14ed7921d980d84fadb6b7fc4f9f55ee86af521d72d11752c092fdfb6

Contents?: true

Size: 996 Bytes

Versions: 7

Compression:

Stored size: 996 Bytes

Contents

require_relative "html_function/comments.rb"
require_relative "html_function/footnotes.rb"
require_relative "html_function/html.rb"
require "metanorma"

module IsoDoc
  class PdfConvert < ::IsoDoc::Convert

    include HtmlFunction::Comments
    include HtmlFunction::Footnotes
    include HtmlFunction::Html

    def initialize(options)
      super
      @tmpimagedir = "_pdfimages"
      @maxwidth = 500
      @maxheight = 800
    end

    def convert(filename, file = nil, debug = false)
      file = File.read(filename, encoding: "utf-8") if file.nil?
      @openmathdelim, @closemathdelim = extract_delims(file)
      docxml, outname_html, dir = convert_init(file, filename, debug)
      result = convert1(docxml, filename, dir)
      return result if debug
      postprocess(result, filename, dir)
      system "rm -fr #{dir}"
      ::Metanorma::Output::Pdf.new.convert(filename + ".html", outname_html + ".pdf")
      system "rm -r #{filename + '.html'} #{@tmpimagedir}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
isodoc-0.8.11 lib/isodoc/pdf_convert.rb
isodoc-0.8.10 lib/isodoc/pdf_convert.rb
isodoc-0.8.9 lib/isodoc/pdf_convert.rb
isodoc-0.8.8 lib/isodoc/pdf_convert.rb
isodoc-0.8.7 lib/isodoc/pdf_convert.rb
isodoc-0.8.6 lib/isodoc/pdf_convert.rb
isodoc-0.8.5 lib/isodoc/pdf_convert.rb