Skip to content

fix: sort embedded file name tree entries - #147

Open
Guflly wants to merge 1 commit into
cantoo-scribe:masterfrom
Guflly:fix/sort-attachment-names
Open

fix: sort embedded file name tree entries#147
Guflly wants to merge 1 commit into
cantoo-scribe:masterfrom
Guflly:fix/sort-attachment-names

Conversation

@Guflly

@Guflly Guflly commented Aug 1, 2026

Copy link
Copy Markdown

What?

Keeps EmbeddedFiles name-tree keys sorted by their encoded PDF bytes.

Why?

Acrobat rejects some attachments when names such as 1.jpg, 2.jpg, and 10.jpg are stored out of order.

How?

The attachment key and reference are inserted at the correct byte-sorted position in the name tree.

Testing?

Ran the full unit suite (804 passed, 1 skipped), typecheck, ESLint, Prettier, and the full build. A targeted Node check and real Chrome and Firefox browser checks verified byte-sorted attachment names in both a newly created PDF and an existing fixture. Chrome's PDF viewer rendered both generated documents. Deno and the complete desktop viewer matrix were not run.

New Dependencies?

No.

Screenshots

N/A.

Suggested Reading?

No.

Anything Else?

Closes #89.

Checklist

  • I read CONTRIBUTING.md.
  • I read MAINTAINERSHIP.md#pull-requests.
  • I added/updated unit tests for my changes.
  • I added/updated integration tests for my changes.
  • I ran the integration tests.
  • I tested my changes in Node, Deno, and the browser.
  • I viewed documents produced with my changes in Adobe Acrobat, Foxit Reader, Firefox, and Chrome.
  • I added/updated doc comments for any new/modified public APIs.
  • My changes work for both new and existing PDF files.
  • I ran the linter on my changes.

@Sharcoux

Copy link
Copy Markdown
Collaborator

Thanks for the PR. You're right about the problem. But I fixed with a commit that also handles the problem with js scripts. Can you test with version 2.8.2 please?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some attachment names cause an error in acrobat reader when using attach function

2 participants