New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for short dash array (invalid border array: [0 0 1 [3]]
)
#766
Comments
Thanks for rerporting this! |
Hi :), we've a similar issue where the validation (relaxed and strict) failed with @hhrutter can you give a time estimate when the bug will be solved? |
Coming up.. |
This should be fixed with latest commit. |
Hello @hhrutter, Thank you for the update. Unfortunately, in our case, it still fails with the same error. I'm not entirely familiar with the PDF specification: Is it permissible to have Regards |
Thank you for the additional research time involved in the committed change. I confirmed it reads the file successfully now. |
@ALL: The latest commit relaxes validation of line dash patterns. |
Hello - I was reading a PDF file and ran into the following error during an
info
/api.PDFInfo
call:tldr... seems like a spec-compliant representation and the package should support the case.
Reproduction
pdfcpu
sample (PDF/1.1, producer Acrobat PDFWriter 2.0 for Windows, circa 1995)
error
Investigation
From some manual debugging of the file, it seems like the error originates first from page 6, subtype of Link. Additionally, the full stack to the failing expectation is included below.
Debug Stack
Reviewing the PDF Reference Manual, Version 1.1, I see the following relevant pieces...
Page 76 (about the Border annotation attribute) it describes 1.1 introducing the fourth, array element. In annotation.go it looks like that is currently supported, but the code expects an array of exactly 2 items. Interestingly, the example given in the manual is exactly what the sample file uses:
Page 147 formally describes the setdash operator (of which the array is the optional, fourth border element).
Page 144 gives several examples of single-item arrays which state its just equivalent on/off spans.
The descriptions of array are a little ambiguous about the maximum number of items and texts suggest the array should simply be cycled through for dash/spacing. But I can only find examples of 0-, 1-, and 2-length arrays (including in PDF 1.7 / 32000-1:2008 reference).
I know this package doesn't rasterize, but, for what its worth, from a Mac the annotation(s) were evaluated as follows:
Proposal
Change validation to the following:
Which then allows the info calls to succeed:
I'm not too familiar with other ways this might affect the codebase, but I didn't see potential side effects from a quick look.
It's not clear to me if/when
ValidationRelaxed
should be respected, but it may be an alternative for this condition, too.I saw the project prefers issues before pull requests, but pushed the one-liner to a branch if you want to merge it as is. If you have some guidance on how you'd test this, I'd be happy to update the branch and/or send a formal PR.
Miscellaneous
The text was updated successfully, but these errors were encountered: