Stirling-PDF/app/core
Ludy dd0e8543e1
fix(multitool): avoid duplicate resource embedding on export to prevent huge PDFs (#4684)
# Description of Changes

**What was changed**
- Reworked Multi-Tool export to **group page copies per source PDF** and
reuse them during assembly.
- Eliminates repeated embedding of identical resources (fonts, XObjects,
images) that previously occurred when copying pages one-by-one.
- Keeps original vector content whenever possible instead of rasterizing
unchanged pages.
- Minor internal refactor to reduce repeated `copyPages` calls and add
pages from a pre-copied cache.

**Why the change was made**
- Users reported that exporting a PDF via Multi-Tool—without making any
edits—could inflate file size by 5x+.
- Root cause: exporting pages individually caused duplicated resources
in the output document, dramatically increasing size.
- Grouping and reusing copied pages avoids redundant embeddings and
yields output sizes much closer to the original.

Closes #4681

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.
2025-10-16 22:36:33 +01:00
..
src fix(multitool): avoid duplicate resource embedding on export to prevent huge PDFs (#4684) 2025-10-16 22:36:33 +01:00
.gitignore feat(security): add PFX alias for PKCS12; accept .crt/.cer/.der certs & .key keys; add certificate-signing tests (#4297) 2025-09-04 15:30:32 +01:00
build.gradle build(deps): bump io.micrometer:micrometer-core from 1.15.3 to 1.15.4 (#4420) 2025-10-06 10:48:45 +01:00