Class: Pdfmult::LaTeXDocument
- Inherits:
-
Object
- Object
- Pdfmult::LaTeXDocument
- Defined in:
- lib/pdfmult.rb
Overview
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.
Constant Summary collapse
- TEMPLATE =
"\\documentclass[<%= class_options %>]{article}\n\\usepackage{pdfpages}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0pt}\n\\begin{document}\n% pages_strings.each do |pages|\n\\includepdf[pages={<%= pages %>},nup=<%= geometry %>]{<%= pdffile %>}%\n% end\n\\end{document}\n"
Instance Attribute Summary collapse
-
#layout ⇒ Object
readonly
Returns the value of attribute layout.
-
#page_count ⇒ Object
readonly
Returns the value of attribute page_count.
-
#pdffile ⇒ Object
readonly
Returns the value of attribute pdffile.
Instance Method Summary collapse
-
#initialize(args) ⇒ LaTeXDocument
constructor
Initializes a LaTeXDocument instance.
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ LaTeXDocument
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
211 212 213 214 215 |
# File 'lib/pdfmult.rb', line 211 def initialize(args) @pdffile = args[:pdffile] @layout = args[:layout] @page_count = args[:page_count] end |
Instance Attribute Details
#layout ⇒ Object (readonly)
Returns the value of attribute layout.
191 192 193 |
# File 'lib/pdfmult.rb', line 191 def layout @layout end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count.
191 192 193 |
# File 'lib/pdfmult.rb', line 191 def page_count @page_count end |
#pdffile ⇒ Object (readonly)
Returns the value of attribute pdffile.
191 192 193 |
# File 'lib/pdfmult.rb', line 191 def pdffile @pdffile end |
Instance Method Details
#to_s ⇒ Object
217 218 219 220 221 |
# File 'lib/pdfmult.rb', line 217 def to_s latex = ERB.new(TEMPLATE, trim_mode: "%<>") latex.result(binding) end |