Extract Pages to new PDF

29 views
Skip to first unread message

Shane Carroll

unread,
Dec 14, 2011, 11:29:28 PM12/14/11
to origami-pdf
Hi.

Using Origami, is it possible to extract pages from an existing PDF
and save them as a new PDF? I've done some experimenting with the
append_page and insert_page methods (example below) but have not been
able to produce the result I need.

The three commented lines denote the methods I have used in my small
test app.

pdfSource = PDF.read('source.pdf')

pdfDest = PDF.new

#pdfDest.insert_page(0,pdfSource.get_page(1))

#pdfDest.insert_page(1,pdfSource.get_page(1))

#pdfDest.append_page(pdfSource.get_page(1))

pdfDest.save("test.pdf")

Is there another way to get this to work using Origami, or is it not
able to extract pages into a new PDF?

Any help would be greatly appreciated. Thanks.

Reply all
Reply to author
Forward
0 new messages