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 =
%q( \documentclass[<%= class_options %>]{article} \usepackage{pdfpages} \pagestyle{empty} \setlength{\parindent}{0pt} \begin{document} % pages_strings.each do |pages| \includepdf[pages={<%= pages %>},nup=<%= geometry %>]{<%= pdffile %>}% % end \end{document} ).gsub(/\A\n/,'').gsub(/^ +/, '')
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
208 209 210 211 212 |
# File 'lib/pdfmult.rb', line 208 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.
188 189 190 |
# File 'lib/pdfmult.rb', line 188 def layout @layout end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count.
188 189 190 |
# File 'lib/pdfmult.rb', line 188 def page_count @page_count end |
#pdffile ⇒ Object (readonly)
Returns the value of attribute pdffile.
188 189 190 |
# File 'lib/pdfmult.rb', line 188 def pdffile @pdffile end |
Instance Method Details
#to_s ⇒ Object
214 215 216 217 218 219 220 |
# File 'lib/pdfmult.rb', line 214 def to_s = 'a4paper' << ',landscape' if layout.landscape? latex = ERB.new(TEMPLATE, 0, '%<>') latex.result(binding) end |