frescobaldi / qpageview

page-based viewer widget for Qt5/PyQt5
https://qpageview.org/
GNU General Public License v3.0
20 stars 9 forks source link

How to remove pages in a doc before rendered in the View ? #6

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi !

I would like to load a pdf and remove, say the first page, BEFORE it is rendered. I've tried to load the pdf normally, then remove a page, but it's very slow as all has to be redrawn again.

Do I really have to use an external pdf parser ?

Thank you very much !

wbsoft commented 3 years ago

Yes, one way to do it is:

import qpageview
doc = qpageview.loadPdf("bla.pdf")
del doc.pages()[0]
v = qpageview.View()
v.show()
v.setDocument(doc)
wbsoft commented 3 years ago

Today I also added the View.setPages() method, to more easily load a list of Page objects.

ghost commented 3 years ago

Thank you !