any lib to extract pages form pdf and then merge?

O

oyster

I want to extract some pages from vary pdf files, then write them
with/witout rotation into one new pdf file. something likes this
[py]
import gfx
doc = gfx.open("pdf", r"Theory.pdf")
pdf = gfx.PDF()
for pagenr in [1,5,7]:
page = doc.getPage(pagenr)

if pagenr==1:
page.rotate(90) #for some pages

pdf.startpage(page.width, page.height)
page.render(pdf)
pdf.endpage()
pdf.save("new pdf.pdf")
[/py]

I have tried pypdf, but it errs and exits on some of my pdfs(no, the
files have no password)

can someone suggest on such a lib for python on windows/or a pure C-dll?
(I mean pdf page->pdf, not pdf page->pic->pdf)

thanx
 
C

CTO

I want to extract some pages from vary pdf files, then write them
with/witout rotation into one new pdf file. something likes this
[py]
import gfx
doc = gfx.open("pdf", r"Theory.pdf")
pdf = gfx.PDF()
for pagenr in [1,5,7]:
    page = doc.getPage(pagenr)

    if pagenr==1:
        page.rotate(90)                                         #for some pages

    pdf.startpage(page.width, page.height)
    page.render(pdf)
    pdf.endpage()
pdf.save("new pdf.pdf")
[/py]

I have tried pypdf, but it errs and exits on some of my pdfs(no, the
files have no password)

can someone suggest on such a lib for python on windows/or a pure C-dll?
(I mean pdf page->pdf, not pdf page->pic->pdf)

thanx

I'd recommend reportlab <URL: http://www.reportlab.org/>. It is mostly
geared towards creating new PDFs, but it is pretty much best-of-breed
AFAICT.

Geremy Condra
 
D

David Boddie

I want to extract some pages from vary pdf files, then write them
with/witout rotation into one new pdf file. something likes this
[...]

I have tried pypdf, but it errs and exits on some of my pdfs(no, the
files have no password)

Maybe you could get in touch with the author to try and work around these
problems.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,103
Latest member
VinaykumarnNevatia
Top