Skip to content

Conversation

@courtneypattison
Copy link
Collaborator

Pull Request Checklist

  • I have run yarn build to ensure that the project builds successfully.
  • I have updated CHANGELOG.md with the necessary changes made in this pull request.
  • I have added documentation for any new functionality from 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

  • Testing on more patterns! I've tested with Wardrobe by Me and Little Lizard King so far.

@vercel
Copy link

vercel bot commented Dec 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
pattern-projector Ready Ready Preview, Comment Dec 22, 2025 8:46pm

@cfcurtis
Copy link
Collaborator

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.

@courtneypattison
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants