Closed Bug 1711064 Opened 3 years ago Closed 3 years ago

Generated pdf are corrupted

Categories

(Core :: Printing: Output, defect, P3)

Firefox 90
defect

Tracking

()

RESOLVED FIXED
91 Branch
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)

STR:

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.

Do you know if it's a recent regression? We recently updated cairo.

Has Regression Range: --- → yes
Has STR: --- → yes
Depends on: 454059
Regressed by: 454059

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?

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.

OK, thanks. One other question (while I wait for my build...), does the resulting PDF actually get a link there, and does it work?

Yes everything works fine: the link is ok and I can open in either pdf.js or chrome.

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?

Flags: needinfo?(cdenizet)

qpdf --version returns 10.1.0 and the platform is a debian bullseye.

Flags: needinfo?(cdenizet)
Attached file mozilla.pdf (deleted) —

Here's the generated pdf.

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

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.

Set release status flags based on info from the regressing bug 454059

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: nobody → jfkthame
Status: NEW → ASSIGNED

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.

Keywords: leave-open
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2989b762829c patch 1 - Add a pref to control whether linkifying Save-as-PDF output is enabled. r=dholbert
Severity: -- → S3
Priority: -- → P3

Do we want to turn the pref off in 90 (now beta), while we wait on the cairo update (presumably for 91)?

Flags: needinfo?(jfkthame)

(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.

Flags: needinfo?(jfkthame)

Sounds good, thanks!

Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/350741703b20 Cherry-pick fix from upstream cairo to resolve missing objects in generated PDF's xref table. r=jrmuizel

Calixte, once the new Nightly with this fix is ready, if you could confirm the problem is resolved that would be great - thanks!

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(cdenizet)
Keywords: leave-open
Resolution: --- → FIXED

WFM, thank you.

Flags: needinfo?(cdenizet)
Target Milestone: --- → 91 Branch

Please nominate this for Beta approval when you get a chance.

Flags: needinfo?(jfkthame)

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:
Flags: needinfo?(jfkthame)
Attachment #9224907 - Flags: approval-mozilla-beta?

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.

Attachment #9224907 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: