class Pdfmult::LaTeXDocument
Class for the LaTeX document.
Create an instance with LaTeXDocument.new
, specifying the input file, the layout, and the page count of the input file.
The method to_s
returns the document as multiline string.
Constants
- TEMPLATE
Attributes
layout[R]
page_count[R]
pdffile[R]
Public Class Methods
new(args)
click to toggle source
Initializes a LaTeXDocument
instance. Expects an argument hash with:
:pdffile
- filename of input pdf file :layout
- page layout :page_count
- page count of the input file
# File lib/pdfmult.rb, line 208 def initialize(args) @pdffile = args[:pdffile] @layout = args[:layout] @page_count = args[:page_count] end
Public Instance Methods
to_s()
click to toggle source
# File lib/pdfmult.rb, line 214 def to_s class_options = 'a4paper' class_options << ',landscape' if layout.landscape? latex = ERB.new(TEMPLATE, 0, '%<>') latex.result(binding) end
Private Instance Methods
geometry()
click to toggle source
# File lib/pdfmult.rb, line 224 def geometry layout.geometry end
pages_per_sheet()
click to toggle source
# File lib/pdfmult.rb, line 228 def pages_per_sheet layout.pages end
pages_strings()
click to toggle source
Returns an array of pages strings. For 4 copies and 2 pages: [“1,1,1,1”, “2,2,2,2”].
# File lib/pdfmult.rb, line 234 def pages_strings pages = (1..page_count).to_a pages.map {|page| ([page] * pages_per_sheet).join(',') } end