doc.new_page() unexpected side effect #2532
-
After adding a new page to a document, all the previously loaded pages become invalid import fitz The expected result should be to 'shift' all pagenumbers of the opened pages. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
This effect cannot be avoided: This is the reason, why on every page creation, deletion, move, copy, |
Beta Was this translation helpful? Give feedback.
-
Hi Jorj I really appreciate PyMuPDF but honestly I don't use it very often since I'm the developer So, I agree with you this is not a PyMuPDF bug - maybe just a lack of documentation if this is the intended side-effect - For tclMuPDF it's very important that all the opened pages be consistent with the related document. So, the problem is not with pdf_insert_page(), but it's with pdf_load_page() MAYBE I've found a solution for my code (and as far as I tested is OK) With a big surprise I've found that a fz_document keeps a list of the opened pages // to be called after each addpage/deletepage In short: and As far As I know this works for PDF, but since it uses the core fz_document*, I fear |
Beta Was this translation helpful? Give feedback.
-
Let me convert this to a "Discussions" item. This is where the post belongs to. |
Beta Was this translation helpful? Give feedback.
-
Page numbers are not a property of MuPDF page objects. Only PyMuPDF assigns In PyMuPDF, you can load the same document page to different But I promise to give this more consideration. |
Beta Was this translation helpful? Give feedback.
-
Addendum: 18-jul-2023 |
Beta Was this translation helpful? Give feedback.
Page numbers are not a property of MuPDF page objects. Only PyMuPDF assigns
page.number
as a convenience to the shadowing PythonPage
object.In contrast to the number, a page's xref is fixed. You can reorder the page tree of a PDF, insert new pages or delete some, and so on: all this changes the sequence number of a potentially unforeseeable set of other pages. But never their cross reference numbers.
The fact that MuPDF keeps a list of loaded pages has nothing to do with this.
So your bug submission to MuPDF is probably unfounded - I can't see your bug's content because of lack of permissions. You may want to authorize me ...
In PyMuPDF, you can load the same document page to different
P…