Skip to content

When updating, write the xref table in the same format as the previous one (bug 1878916)#17636

Merged
calixteman merged 1 commit intomozilla:masterfrom
calixteman:bug1878916
Feb 13, 2024
Merged

When updating, write the xref table in the same format as the previous one (bug 1878916)#17636
calixteman merged 1 commit intomozilla:masterfrom
calixteman:bug1878916

Conversation

@calixteman
Copy link
Contributor

The specs are unclear about what kind of xref table format must be used.
In checking the validity of some pdfs in the preflight tool from Acrobat we can guess that having the same format is the correct way to do.
The pdf in the mentioned bug, after having been changed, wasn't correctly displayed in neither Chrome nor Acrobat: it's now fixed.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving a couple of comments based on an initial (quick) look.
Please run all tests, and I'll try to finish reviewing this ASAP.

@calixteman
Copy link
Contributor Author

FYI, in Edge with the pdf viewer from Acrobat, they're saving files thanks to an incremental update and they're doing exactly what this patch is aiming to do: use the same xref table kind as the last one.
/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 1

Live output at: http://54.193.163.58:8877/7b51e7a315407fc/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 1

Live output at: http://54.241.84.105:8877/5d3d0df684ff262/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/5d3d0df684ff262/output.txt

Total script time: 24.91 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 17
  different first/second rendering: 2

Image differences available at: http://54.241.84.105:8877/5d3d0df684ff262/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/7b51e7a315407fc/output.txt

Total script time: 41.94 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 4

Image differences available at: http://54.193.163.58:8877/7b51e7a315407fc/reftest-analyzer.html#web=eq.log

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/b68aa67cc55ec9a/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/51ce1826ac09946/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/b68aa67cc55ec9a/output.txt

Total script time: 24.77 mins

  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 15
  different first/second rendering: 2

Image differences available at: http://54.241.84.105:8877/b68aa67cc55ec9a/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/51ce1826ac09946/output.txt

Total script time: 42.04 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 4

Image differences available at: http://54.193.163.58:8877/51ce1826ac09946/reftest-analyzer.html#web=eq.log

@jberkenbilt
Copy link
Contributor

jberkenbilt commented Feb 12, 2024

Chiming in here, qpdf recognizes this as a valid file, and my manual decoding of the file also suggests that its valid. I am also able to open this file with firefox, chrome, evince, okular, atril, ghostscript, and Adobe Acrobat, though the mac preview application fails to open the file. My opinion is that there's nothing wrong with mixing xref tables and xref streams, though clearly there are some readers that can't handle it, which may be a good reason not to mix and match as a rule.

It is curious that the file in the referenced qpdf issue qpdf/qpdf#1148 has /Prev pointing to white space preceding the original startxref from the file prior to being appended, but that's not technically incorrect.

@jberkenbilt
Copy link
Contributor

(My opinion, not that it's relevant here since I'm an outsider, is that it would be better not to mix and match.)

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is slightly complicated code, but I think it makes sense (and the updated patch is much easier to follow.)

r=me, thank you!

…s one (bug 1878916)

The specs are unclear about what kind of xref table format must be used.
In checking the validity of some pdfs in the preflight tool from Acrobat
we can guess that having the same format is the correct way to do.
The pdf in the mentioned bug, after having been changed, wasn't correctly
displayed in neither Chrome nor Acrobat: it's now fixed.
@calixteman calixteman merged commit 14874e5 into mozilla:master Feb 13, 2024
@calixteman calixteman deleted the bug1878916 branch February 13, 2024 13:45
calixteman added a commit to calixteman/pdf.js that referenced this pull request Oct 3, 2025
This patch removes some previous fixes which are now likely fixed by mozilla#17636.

Fixes mozilla#20302.
calixteman added a commit to calixteman/pdf.js that referenced this pull request Oct 4, 2025
This patch removes some previous fixes which are now likely fixed by mozilla#17636.

Fixes mozilla#20302.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants