Module: Prune

Included in:
Elements::Catalog
Defined in:
lib/prune.rb,
lib/prune/errors.rb,
lib/prune/document.rb,
lib/prune/constants.rb,
lib/prune/functions.rb,
lib/prune/fonts/base.rb,
lib/prune/shapes/base.rb,
lib/prune/shapes/line.rb,
lib/prune/parsers/base.rb,
lib/prune/elements/base.rb,
lib/prune/elements/font.rb,
lib/prune/elements/info.rb,
lib/prune/elements/page.rb,
lib/prune/fonts/base_en.rb,
lib/prune/fonts/base_ja.rb,
lib/prune/elements/pages.rb,
lib/prune/p_objects/base.rb,
lib/prune/elements/stream.rb,
lib/prune/fonts/en/symbol.rb,
lib/prune/shapes/text_box.rb,
lib/prune/elements/catalog.rb,
lib/prune/fonts/en/courier.rb,
lib/prune/p_objects/p_name.rb,
lib/prune/shapes/rectangle.rb,
lib/prune/elements/outlines.rb,
lib/prune/p_objects/aliases.rb,
lib/prune/p_objects/p_array.rb,
lib/prune/fonts/en/helvetica.rb,
lib/prune/fonts/ja/ms_gothic.rb,
lib/prune/fonts/ja/ms_mincho.rb,
lib/prune/p_objects/p_stream.rb,
lib/prune/fonts/en/times_roman.rb,
lib/prune/fonts/ja/ms_p_gothic.rb,
lib/prune/fonts/ja/ms_p_mincho.rb,
lib/prune/fonts/ja/ms_pr_gothic.rb,
lib/prune/fonts/ja/ms_ui_gothic.rb,
lib/prune/fonts/en/zapf_dingbats.rb,
lib/prune/p_objects/p_dictionary.rb,
lib/prune/elements/procedure_sets.rb,
lib/prune/parsers/document_parser.rb,
lib/prune/elements/font_descriptor.rb,
lib/prune/p_objects/p_literal_string.rb,
lib/prune/parsers/document/page_parser.rb,
lib/prune/p_objects/p_hexadecimal_string.rb,
lib/prune/parsers/document/property_parser.rb,
lib/prune/parsers/document/page/table_parser.rb,
lib/prune/parsers/document/page/table/tr_parser.rb

Defined Under Namespace

Modules: Elements, Errors, Fonts, Functions, PObjects, Parsers, Shapes Classes: Document

Constant Summary collapse

VERSION =

Version of Prune.

"0.0.4"
APPLICATION =

Application name.

self.name
LF =

Line feed code.

"\n"
DOCUMENT_SIZES =

Document sizes(width and height in milli-meters).

{
  :A1 => [594.0,  841.0], :A1W => [ 841.0, 594.0],
  :A2 => [420.0,  594.0], :A2W => [ 594.0, 420.0],
  :A3 => [297.0,  420.0], :A3W => [ 420.0, 297.0],
  :A4 => [210.0,  297.0], :A4W => [ 297.0, 210.0],
  :A5 => [148.0,  210.0], :A5W => [ 210.0, 148.0],
  :A6 => [105.0,  148.0], :A6W => [ 148.0, 105.0],
  :A7 => [ 74.0,  105.0], :A7W => [ 105.0,  74.0],
  :B1 => [728.0, 1030.0], :B1W => [1030.0, 728.0],
  :B2 => [515.0,  728.0], :B2W => [ 728.0, 515.0],
  :B3 => [364.0,  515.0], :B3W => [ 515.0, 364.0],
  :B4 => [257.0,  364.0], :B4W => [ 364.0, 257.0],
  :B5 => [182.0,  257.0], :B5W => [ 257.0, 182.0],
  :B6 => [128.0,  182.0], :B6W => [ 182.0, 128.0],
  :B7 => [ 91.0,  128.0], :B7W => [ 128.0,  91.0],
}
PAGE_LAYOUT =

Page layout

[
  :SinglePage,
  :OneColumn,
  :TwoColumnLeft,
  :TwoColumnRight
]

Class Method Summary collapse

Class Method Details

.pdf(filename = nil, &block) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/prune.rb', line 76

def self.pdf(filename = nil, &block)
  # Build document.
  @document = Document.new
  @document_parser = Parsers::DocumentParser.new(@document)
  @document_parser.instance_eval(&block)

  unless filename.nil?
    filename << ".pdf" unless /\.[pP][dD][fF]\z/ === filename
    @document.save_as(filename)
  else
    @document.to_s
  end
end