Generated pdf are corrupted
Categories
(Core :: Printing: Output, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr78 | --- | unaffected |
firefox88 | --- | unaffected |
firefox89 | --- | unaffected |
firefox90 | --- | fixed |
firefox91 | --- | fixed |
People
(Reporter: calixte, Assigned: jfkthame)
References
(Regression)
Details
(Keywords: regression)
Attachments
(3 files)
(deleted),
application/pdf
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details |
STR:
- open https://commons.wikimedia.org/wiki/File:HelloWorld.svg
- print and save as
mozilla.pdf
- run
qpdf --check mozilla.pdf
Result:
checking mozilla.pdf
PDF Version: 1.5
File is not encrypted
File is not linearized
WARNING: mozilla.pdf: file is damaged
WARNING: mozilla.pdf (object 3 0, offset 15): expected 3 0 obj
WARNING: mozilla.pdf: Attempting to reconstruct cross-reference table
WARNING: mozilla.pdf: object 3 0 not found in file after regenerating cross reference table
The pdf contains an object with ref 27 0
and this one makes ref to 3 0
but 27 0
is not used.
It isn't really a bug since the pdf is readable but it'd be nice to generate a valid pdf.
Comment 1•3 years ago
|
||
Do you know if it's a recent regression? We recently updated cairo.
Reporter | ||
Comment 2•3 years ago
|
||
With mozregression I got:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=e02533b47a679aeeaa52bb5a88e04cdbbfc251e2&tochange=26b31c2612b4b6ea5b1771b3bdef1031f457a98f
(fun fact: I was testing bug 454059)
Assignee | ||
Comment 3•3 years ago
|
||
Is this reproducible only with an SVG document [edit: a page that includes an SVG image], or can you also reproduce a similar issue with other HTML docs?
Reporter | ||
Comment 4•3 years ago
|
||
Easily reproducible in printing doc containing:
<a href="https://www.mozilla.org">mozilla</a>
The generated pdf contains:
11 0 obj
[
3 0 R
4 0 R
]
this object is not used but it contains invalid references.
If I replace the a
by a span
, there are no issues.
Assignee | ||
Comment 5•3 years ago
|
||
OK, thanks. One other question (while I wait for my build...), does the resulting PDF actually get a link there, and does it work?
Reporter | ||
Comment 6•3 years ago
|
||
Yes everything works fine: the link is ok and I can open in either pdf.js or chrome.
Assignee | ||
Comment 7•3 years ago
|
||
Hmm, so far I haven't been able to reproduce this; qpdf --check
doesn't report any issues for me.
Which platform are you testing Firefox on? What version does qpdf report for itself?
Reporter | ||
Comment 8•3 years ago
|
||
qpdf --version
returns 10.1.0
and the platform is a debian bullseye.
Reporter | ||
Comment 9•3 years ago
|
||
Here's the generated pdf.
Reporter | ||
Comment 10•3 years ago
|
||
I just built qpdf
from https://github.com/qpdf/qpdf and the output is the same:
./qpdf --version && ./qpdf --check ~/Téléchargements/mozilla.pdf
qpdf version 10.3.2
Run qpdf --copyright to see copyright and license information.
checking /home/calixte/Téléchargements/mozilla.pdf
PDF Version: 1.5
File is not encrypted
File is not linearized
WARNING: /home/calixte/Téléchargements/mozilla.pdf: file is damaged
WARNING: /home/calixte/Téléchargements/mozilla.pdf (object 3 0, offset 15): expected 3 0 obj
WARNING: /home/calixte/Téléchargements/mozilla.pdf: Attempting to reconstruct cross-reference table
WARNING: /home/calixte/Téléchargements/mozilla.pdf: object 3 0 not found in file after regenerating cross reference table
Assignee | ||
Comment 11•3 years ago
|
||
Thanks. After updating qpdf, I now get the same warnings from it; my Ubuntu had an older version that I guess doesn't have as many checks.
Updated•3 years ago
|
Comment 12•3 years ago
|
||
Set release status flags based on info from the regressing bug 454059
Assignee | ||
Comment 13•3 years ago
|
||
I guess this is an upstream cairo issue -- I'm hoping to dig in a bit and try to figure out what it's doing. Fortunately, the usability of the resulting PDF doesn't seem to be affected, but we should still try to fix it.
First thing, though, is that I think we should add a pref to control whether links are generated in the PDF at all (should've done this as part of the original landing). That way we can easily turn off the feature if it proves problematic in any way.
Assignee | ||
Comment 14•3 years ago
|
||
Updated•3 years ago
|
Assignee | ||
Comment 15•3 years ago
|
||
Marking as leave-open, as the above patch doesn't fix the actual issue; it just adds a pref to control whether the feature is active.
Comment 16•3 years ago
|
||
Assignee | ||
Updated•3 years ago
|
Comment 17•3 years ago
|
||
bugherder |
Assignee | ||
Comment 18•3 years ago
|
||
Filed https://gitlab.freedesktop.org/cairo/cairo/-/issues/487 about the underlying cairo issue.
Assignee | ||
Comment 19•3 years ago
|
||
I've posted a possible fix at https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/185.
Comment 20•3 years ago
|
||
Do we want to turn the pref off in 90 (now beta), while we wait on the cairo update (presumably for 91)?
Updated•3 years ago
|
Assignee | ||
Comment 21•3 years ago
|
||
(In reply to Julien Cristau [:jcristau] from comment #20)
Do we want to turn the pref off in 90 (now beta), while we wait on the cairo update (presumably for 91)?
The cairo fix has been merged upstream, so I'd prefer to cherry-pick and uplift that to 90 (it's a trivial patch) if possible, rather than disable the feature. I'm on PTO today but plan to post a patch here tomorrow.
Comment 22•3 years ago
|
||
Sounds good, thanks!
Assignee | ||
Comment 23•3 years ago
|
||
See https://gitlab.freedesktop.org/cairo/cairo/-/issues/487 for details. This was merged upstream in
https://gitlab.freedesktop.org/cairo/cairo/-/commit/2edcb1ac2385c670c36d7ae53ae7de1637969ced;
Comment 24•3 years ago
|
||
Comment 25•3 years ago
|
||
bugherder |
Assignee | ||
Comment 26•3 years ago
|
||
Calixte, once the new Nightly with this fix is ready, if you could confirm the problem is resolved that would be great - thanks!
Updated•3 years ago
|
Comment 28•3 years ago
|
||
Please nominate this for Beta approval when you get a chance.
Assignee | ||
Comment 29•3 years ago
|
||
Comment on attachment 9224907 [details]
Bug 1711064 - Cherry-pick fix from upstream cairo to resolve missing objects in generated PDF's xref table. r=jrmuizel
Beta/Release Uplift Approval Request
- User impact if declined: Some validators may report that PDFs generated by Print / Save as PDF have errors.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Trivial patch cherry-picked from upstream.
- String changes made/needed:
Comment 30•3 years ago
|
||
Comment on attachment 9224907 [details]
Bug 1711064 - Cherry-pick fix from upstream cairo to resolve missing objects in generated PDF's xref table. r=jrmuizel
Approved for 90.0b4.
Comment 31•3 years ago
|
||
bugherder uplift |
Description
•