Remove hidden layers from PDF when exporting #412#413
Remove hidden layers from PDF when exporting #412#413courtneypattison wants to merge 1 commit intobetafrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Wow, that was fast! This is a bit of a rabbit hole, and like you say it might not work for every PDF, so I'm not sure if you'd want it to happen by default. I discovered with PDFstitcher that removing layers isn't always as simple as removing everything between BDC/EMC commands because state changes inside layers persist outside. That means that if there's some change like stroke colour/thickness, font size, etc that happens "in" a layer, it affects the subsequent drawing operations. My workaround for this was to only remove the "showing" operators in a layer that actually draw stuff and keep the state changes in place, which could probably be replicated here, but it's slow and not ideal. I'm travelling for holidays right now so I don't have time for a full review/test, but I can do that in January if you'd like. |
|
Thank you for the feedback @cfcurtis ! I'll take another pass at this PR with that information in mind and see if I can write something more robust. I'll ping you when I've made those changes to see if you have time to look it over. Thanks again! Happy holidays :) |
Pull Request Checklist
yarn buildto ensure that the project builds successfully.CHANGELOG.mdwith the necessary changes made in this pull request.Description
Stitching now removes hidden layers from the PDF when exporting. With the string/stream manipulation in this change, I'm sure many PDFs will have issues, but I wanted to share a possible solution to #412.
Related Issues
#412
TODO