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
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