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
The removed page was copied and the last page of the document was not. From what I noticed this is because getPageIndices works correctly, but inside the copyPages function we call getPages and this still holds a reference to the removed page.
What did you expect to happen?
copyPages/getPages functions are not holding and working with a removed page
Looks like removePage is missing this.pageCache.invalidate(); as insertPage has.
Tested, adding this line fixes the issue.
Another alternative to avoid forking the project, as it seems no receiving support anymore, is to call insertPage or addPage to force the cache invalidation.
It will still have this latest page in cache, but it's easier to handle as it's now only the latest index affected.
What were you trying to do?
Remove the first page from a PDF and then copy all its pages to the main PDF.
How did you attempt to do it?
What actually happened?
The removed page was copied and the last page of the document was not. From what I noticed this is because getPageIndices works correctly, but inside the copyPages function we call getPages and this still holds a reference to the removed page.
What did you expect to happen?
copyPages/getPages functions are not holding and working with a removed page
How can we reproduce the issue?
https://jsfiddle.net/2mpk8otf/
Link where you can see that getPages still hold reference to the old page after removal, while getPageCount and getPageIndices work correctly.
Version
1.17
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: