[
https://issues.apache.org/jira/browse/PDFBOX-4203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17304329#comment-17304329
]
Michael Klink commented on PDFBOX-4203:
---------------------------------------
{quote}PDF file I have has a very long sequence of characters *before* the
version information appears.
{quote}
According to the specification, _The PDF file begins with the 5 characters
“%PDF–”_.
Thus, if your file begins with something else, it is not even a PDF file to
start with but merely a file that somewhere insides (probably) embeds a PDF
file.
There is a history of PDF browsers allowing a certain amount of trash bytes
before the PDF header, but that does not make such trash valid, it merely
tolerates it.
> java.io.IOException: Error: Header doesn't contain versioninfo
> ---------------------------------------------------------------
>
> Key: PDFBOX-4203
> URL: https://issues.apache.org/jira/browse/PDFBOX-4203
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Reporter: Chenyue Gao
> Priority: Major
>
> When I load a PDF file with PDDocument.load(), it throws the following
> exception. This PDF can be opened with Adobe Reader or browsers with no
> issues. Sorry, I can't share the PDF because it contains confidential
> information.
> [2018-04-19 12:06:35] java.io.IOException: Error: Header doesn't contain
> versioninfo
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:235)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1012)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:968)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:916)
> at com.utilities.PDFUtilities.addPackingSlipPDPage(PDFUtilities.java:279)
> at
> com.commands.PrintPackingSlipToPDFCommand.run(PrintPackingSlipToPDFCommand.java:103)
> at com.commands.AbstractCommand.execute(AbstractCommand.java:74)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]