Sha256: 3dd1c1e46927a645bd104700579684ccfe6f2e7c203e61a889469c9acbb4623f

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

require 'rghost'

module Asciidoctor
module PDF
class Optimizer
  def initialize quality = 'default', compatibility_level = '1.4'
    @quality = quality.empty? ? :default : quality.to_sym
    @compatibility_level = compatibility_level
  end

  def generate_file target
    filename_o = (filename = Pathname.new target).sub_ext '-o.pdf'
    pdfmark = filename.sub_ext '.pdfmark'
    (::RGhost::Convert.new target).to :pdf,
      filename: filename_o.to_s,
      quality: @quality,
      d: { Printed: false, CannotEmbedFontPolicy: '/Warning', CompatibilityLevel: @compatibility_level },
      raw: pdfmark.file? ? pdfmark.to_s : nil
    filename_o.rename target
  end
end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.beta.6 lib/asciidoctor/pdf/optimizer.rb