lib/combine_pdf.rb in combine_pdf-0.0.7 vs lib/combine_pdf.rb in combine_pdf-0.0.8

- old
+ new

@@ -43,11 +43,11 @@ # or even a one liner: # (CombinePDF.new("file1.pdf") << CombinePDF.new("file2.pdf") << CombinePDF.new("file3.pdf")).save("combined.pdf") # you can also add just odd or even pages: # pdf = CombinePDF.new # i = 0 -# CombinePDF.new("file.pdf").pages.each do |page +# CombinePDF.new("file.pdf").pages.each do |page| # i += 1 # pdf << page if i.even? # end # pdf.save "even_pages.pdf" # notice that adding all the pages one by one is slower then adding the whole file. @@ -126,9 +126,14 @@ # Create a PDF object from a raw PDF data (parsing the data). # data:: is a string that represents the content of a PDF file. def parse(data) raise TypeError, "couldn't parse and data, expecting type String" unless data.is_a? String PDF.new( PDFParser.new(data) ) + end + # makes a PDFWriter object + # ::mediabox an Array representing the size of the PDF document. defaults to: [0.0, 0.0, 612.0, 792.0] + def create_page(mediabox = [0.0, 0.0, 612.0, 792.0]) + PDFWriter.new mediabox end end