Module: CombinePDF

Defined in:
lib/combine_pdf/combine_pdf_pdf.rb,
lib/combine_pdf.rb,
lib/combine_pdf.rb,
lib/combine_pdf/combine_pdf_filter.rb,
lib/combine_pdf/combine_pdf_parser.rb,
lib/combine_pdf/combine_pdf_decrypt.rb,
lib/combine_pdf/combine_pdf_basic_writer.rb

Overview

Thoughts from reading the ISO 32000-1:2008 this file is part of the CombinePDF library and the code is subject to the same license.

Defined Under Namespace

Modules: PDFFilter, PDFOperations Classes: PDF, PDFDecrypt, PDFParser, PDFWriter, RC4

Constant Summary collapse

PRIVATE_HASH_KEYS =

These are common functions, used within the different classes These functions aren’t open to the public.

[:indirect_reference_id, :indirect_generation_number, :raw_stream_content, :is_reference_only, :referenced_object, :indirect_without_dictionary]
LITERAL_STRING_REPLACEMENT_HASH =
{
110 => 10, # "\\n".bytes = [92, 110]  "\n".ord = 10
114 => 13, #r
116 => 9, #t
98 => 8, #b 
102 => 255, #f
40 => 40, #(
41 => 41, #)
92 => 92 #\
}

Class Method Summary collapse

Class Method Details

.new(file_name = "") ⇒ Object

These are the “gateway” functions for the model. These functions are open to the public.

PDF object types cross reference: Indirect objects, references, dictionaries and streams are Hash arrays are Array strings are String names are Symbols (String.to_sym) numbers are Fixnum or Float boolean are TrueClass or FalseClass

Raises:

  • (TypeError)


81
82
83
84
85
# File 'lib/combine_pdf.rb', line 81

def new(file_name = "")
	raise TypeError, "couldn't parse and data, expecting type String" unless file_name.is_a? String
	return PDF.new() if file_name == ''
	PDF.new( PDFParser.new(  IO.read(file_name).force_encoding(Encoding::ASCII_8BIT) ) )
end

.parse(data) ⇒ Object

Raises:

  • (TypeError)


86
87
88
89
# File 'lib/combine_pdf.rb', line 86

def parse(data)
	raise TypeError, "couldn't parse and data, expecting type String" unless data.is_a? String
	PDF.new( PDFParser.new(data) )
end