Skip to content

feat: add files order control for merge endpoint#277

Open
Nitram1123 wants to merge 1 commit into
sensiolabs:1.xfrom
Nitram1123:feat/merge-files-order
Open

feat: add files order control for merge endpoint#277
Nitram1123 wants to merge 1 commit into
sensiolabs:1.xfrom
Nitram1123:feat/merge-files-order

Conversation

@Nitram1123

Copy link
Copy Markdown

Introduce sortFilesByName() and sortFilesByCall() on MergePdfBuilder to control how Gotenberg orders files in the merged PDF.

The merge endpoint sorts files alphanumerically by their multipart filename. sortFilesByCall() prefixes each multipart filename with a zero-padded counter (e.g. 000001-document.pdf) so the merge follows the order in which files() was called. sortFilesByName() restores the default behavior. Files on disk are never renamed.

Closes #264

Q A
Gotenberg API version ? 8.x
Bug fix ? no
New feature ? yes
BC break ? no
Issues Fix #264

Comment thread src/Builder/Behaviors/FilesOrderTrait.php
Comment thread src/Builder/Behaviors/FilesOrderTrait.php Outdated
Comment thread src/Builder/Pdf/MergePdfBuilder.php Outdated
Comment thread src/Builder/Util/NormalizerFactory.php Outdated
@Nitram1123 Nitram1123 force-pushed the feat/merge-files-order branch 5 times, most recently from 5774620 to f7a03fb Compare June 2, 2026 07:25
@Nitram1123 Nitram1123 force-pushed the feat/merge-files-order branch from f7a03fb to 0eeb783 Compare June 5, 2026 15:05
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.

feat: allow sorting sent files

2 participants