You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tool that edits a PDF template and there are times when some pages aren't necessary. This was simple to do utilizing the removePage() method on the doc object. But it does leave the page, just removes the tree reference. The problem is I need to add page numbers and the removed pages remain at the specified indices. I tried looking at getPageIndices() but that only spits out an array of 0 to pages-1.
So if I have a 12 page document and need to remove pages 3, 4 and 8...I removePage(2), removePage(3), removePage(7).
Then if I getPages(), it's still length of 12, iterates (forEach or for loop) through indices 2, 3, and 7 so page numbering goes 1, 2, 5, 6, 7, 9... instead of 1, 2, 3, 4, 5...
So how do I know which pages have been removed. I've dug through PDFPage properties (doc, ref, node) to see if there's any flag there that says "this page has been removed" but I don't see it anywhere. How do I check for removed pages?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have tool that edits a PDF template and there are times when some pages aren't necessary. This was simple to do utilizing the removePage() method on the doc object. But it does leave the page, just removes the tree reference. The problem is I need to add page numbers and the removed pages remain at the specified indices. I tried looking at getPageIndices() but that only spits out an array of 0 to pages-1.
So if I have a 12 page document and need to remove pages 3, 4 and 8...I removePage(2), removePage(3), removePage(7).
Then if I getPages(), it's still length of 12, iterates (forEach or for loop) through indices 2, 3, and 7 so page numbering goes 1, 2, 5, 6, 7, 9... instead of 1, 2, 3, 4, 5...
So how do I know which pages have been removed. I've dug through PDFPage properties (doc, ref, node) to see if there's any flag there that says "this page has been removed" but I don't see it anywhere. How do I check for removed pages?
Beta Was this translation helpful? Give feedback.
All reactions