New issue
Advanced search Search tips

Issue 855097 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 7
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

PDF exports invalid encoding for floating point numbers

Reported by and...@avit.ca, Jun 21 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15

Steps to reproduce the problem:
1. Use chromedriver to export to PDF (with some kinds of content positioning)
2. Open the file in Acrobat Reader (not Mac Preview.app or others)
3. Scroll to the affected page

You can also verify the PDF with `qpdf --check FILE`

What is the expected behavior?
Acrobat Reader should render the page correctly without an error or blank page.

What went wrong?
An error is presented in Acrobat Reader for Windows

A blank page is presented in Acrobat Reader for Mac

`qpdf --check` reports `WARNING: (object 567 0, offset 548059): unknown token while reading object; treating as string`

Did this work before? N/A 

Chrome version: ChromeDriver 2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011)  Channel: n/a
OS Version: OS X 10.13.4
Flash Version: 

The PDF output source contains some floating point numbers in exponential notation (scientific notation), e.g.

    /Matrix [0.71886796 0 0 0.71886796 0 3.0517578e-05]

This depends on the range of the specific number. Converting these to standard notation fixes the error.
 
Labels: Needs-Feedback
Can you describe step 1. How you are generating the PDF?

Comment 2 by and...@avit.ca, Jun 21 2018

I'm using the puppeteer npm package; it calls chromedriver with 'Page.printToPdf'. (Or, effectively `chrome --headless --print-to-pdf URL`)

I'm having a hard time locating an example URL to use for showing the error, but it seems to happen when some element on the page is scaled or positioned in a way that produces a floating point number smaller than "0.0001" and is thus represented as "1.0e-5" in the PDF source, which is not recognized as a number.
Project Member

Comment 3 by sheriffbot@chromium.org, Jun 21 2018

Cc: dtapu...@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -dtapu...@chromium.org
Components: Internals>Printing
Cc: halcanary@chromium.org
Components: -Internals>Printing Internals>Skia>PDF
Labels: Needs-Feedback
Can you attach a sample PDF?

Comment 7 by and...@avit.ca, Jun 26 2018

This one was hard to reproduce, but I'm pretty sure I isolated the source of this error to a PDF processor that was downstream from Chrome.

Please close this issue, my apologies for raising this here.
Project Member

Comment 8 by sheriffbot@chromium.org, Jun 26 2018

Cc: thestig@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: WontFix (was: Unconfirmed)
No worries. Glad you figured it out.
I also encountered this problem with our product, which uses Chromium as a PDF generator.
Acrobat refuses to open a PDF when a /Matrix contains numbers in exponential notation.
It seems that the PDF specification does not allow numbers in exponential notation, so the PDF output is not compliant to the PDF spec.

3.2.2  Numeric Objects
https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdf_reference_archive/pdf_reference_1-7.pdf#page=52

I think I can make a test case if necessary, but I do not have enough time for it at the moment.
What version of Chromium? Please attach a sample input data + output PDF.
Chromium version is m69.
I will post a reduced test case when I have time.
In my case, an SVG element with a linear gradient was the cause of the problem.
The output PDF contains the following matrix:

/Matrix [4.1669888 -6.2959415e-10 1.20559163e-9 4.1599569 0.32287598 1.28405762]

When I replace two numbers in exponential notation with 0, the PDF can be opened with Acrobat.
As thestig@ points out, I can't look into this bug until you share a PDF.
Labels: Needs-Feedback
Status: Unconfirmed (was: WontFix)
Status: WontFix (was: Unconfirmed)
Mac triage: WontFix - this bug isn't actionable without a repro case.

Sign in to add a comment