[
https://issues.apache.org/jira/browse/PDFBOX-5449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17544118#comment-17544118
]
Ravi Thapa commented on PDFBOX-5449:
------------------------------------
Thanks Tilman, Appreciate for the quick response and I upgraded the PDFBox to
2.0.26 and it worked.
Just wanted to know what was the problem happening to these PDF files. Wanted
to understand what was the fix which was applied for this.
> Error occurred while processing the File:expected='endstream' actual='' at
> offset 142940
> ----------------------------------------------------------------------------------------
>
> Key: PDFBOX-5449
> URL: https://issues.apache.org/jira/browse/PDFBOX-5449
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 1.8.9
> Environment: Development
> Reporter: Ravi Thapa
> Priority: Critical
>
> Hi All
> I am getting this error for a specific file while loading.
> *PDDocument doc = PDDocument.load(new File(k))*
> Error occurred while processing the File:expected='endstream' actual='' at
> offset 142940.
> I am not sure what is the problem here. Can you guys recommend what i need to
> do to fix this issue.
> My code looks like this
> PDFMergerUtility mergePdf = new PDFMergerUtility()
> def i = 0
> pdfFileUrlList.each { k, v ->
> i++
> PDDocument doc = PDDocument.load(new File(k))
> if (doc.isEncrypted())
> {
> log.info("Document is encrypted :" + k)
> doc.decrypt("")
> doc.setAllSecurityToBeRemoved(true)
> def newFile = tempPath + "decryptFile_" + i + ".pdf"
> doc.save(newFile)
> mergePdf.addSource(new File(newFile))
> }
> else
> {
> mergePdf.addSource(k)
> }
> doc.close()
> }
>
> Below is the exception stacktrace
>
> java.io.IOException: expected='endstream' actual='' at offset 142940
> at
> org.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:607)
> at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:650)
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:203)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1220)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1187)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1158)
> at org.apache.pdfbox.pdmodel.PDDocument$load.call(Unknown Source)
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]