Repository navigation
fix: base64 and document images corrupted or missing in PDF export - #106
Merged
Merged
Conversation
Herafia
force-pushed
the
fix/pdf-images-sanitized-src-12
branch
from
October 26, 2026 14:27
1f15112 to
6278ae6
Compare
Mary-Clb
reviewed
Oct 27, 2026
Mary-Clb
left a comment
There was a problem hiding this comment.
Document images are now inlined as base64 before tables are split, so a ~750 KB screenshot inside a table makes the table preg_split hit pcre.backtrack_limit; it returns false and the whole description vanishes from the PDF. Could you resolve images after the table split, and add a test with a ~1 MB document.send.php?docid= image inside a table?
jdurand-teclib
requested changes
Oct 27, 2026
jdurand-teclib
previously approved these changes
Oct 28, 2026
4 tasks
Rom1-B
requested changes
Oct 28, 2026
Rom1-B
left a comment
There was a problem hiding this comment.
Can you add a test with a ~1.5 MB pasted base64 image, inside and outside a table?
Mary-Clb
previously approved these changes
Nov 2, 2026
Mary-Clb
left a comment
There was a problem hiding this comment.
LGTM once the requested changes from Romain are done
Herafia
marked this pull request as draft
November 3, 2026 14:21
Herafia
marked this pull request as ready for review
November 3, 2026 14:29
RomainLvr
approved these changes
Nov 9, 2026
Rom1-B
approved these changes
Nov 16, 2026
Rom1-B
pushed a commit
that referenced
this pull request
Nov 18, 2026
## Checklist before requesting a review *Please delete options that are not relevant.* - [ ] I have performed a self-review of my code. - [ ] I have added tests (when available) that prove my fix is effective or that my feature works. - [ ] I have updated the CHANGELOG with a short functional description of the fix or new feature. - [ ] This change requires a documentation update. ## Description Implemented the fix from #106 in #11 (#102): images are replaced with placeholders before tables are split, and pcre.backtrack_limit is increased during TCPDF rendering. Without this, a large document image in a table would cause the entire PDF description to disappear. Added a test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist before requesting a review
Please delete options that are not relevant.
Description
The re-sanitization added to displayText() encodes “=” and “+” in the attributes: document images were no longer recognized (white areas) and base64 images were corrupted, causing TCPDF (imagecolorat) to crash. The src attribute of each image is now decoded; the image is validated using GD and then passed to TCPDF as a data stream; any unreadable image is ignored.