PDF exports invalid encoding for floating point numbers
Reported by
and...@avit.ca,
Jun 21 2018
|
|||||||||
Issue descriptionUserAgent: 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.
,
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.
,
Jun 21 2018
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
,
Jun 21 2018
,
Jun 22 2018
,
Jun 22 2018
Can you attach a sample PDF?
,
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.
,
Jun 26 2018
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
,
Jun 26 2018
No worries. Glad you figured it out.
,
Dec 5
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.
,
Dec 5
What version of Chromium? Please attach a sample input data + output PDF.
,
Dec 5
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.
,
Dec 5
As thestig@ points out, I can't look into this bug until you share a PDF.
,
Dec 5
,
Jan 7
Mac triage: WontFix - this bug isn't actionable without a repro case. |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by dtapu...@chromium.org
, Jun 21 2018