I am generating a file input part of a multipart form via PDFDocument.save() (adding the part via FormData.append()). On the server, I'm trying to open the received pdf file with pdfBox. I'm getting the following error.
Caused by: java.io.IOException: Missing root object specification in trailer. at org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2947) ~[pdfbox-2.0.26.jar:2.0.26]
The exception says that the specification is missing in the trailer but when I look at the data that was uploaded, the trailer is completely missing.
Is there some parameter that I can send to save() to make sure the trailer dictionary is produced?
How did you attempt to do it?
I created browser-side javascript that is saving the pdf content (via PDFDocument.save()) to an array that is being posted to a server as part of a multipart form.
What actually happened?
In my server code, when I try to read the posted pdf document, pdfBox gives me this exception:
Caused by: java.io.IOException: Missing root object specification in trailer. at org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2947) ~[pdfbox-2.0.26.jar:2.0.26]
What did you expect to happen?
I expected pdfBox to be able to open the document.
How can we reproduce the issue?
The code is not short to do this, since an ajax call is being made that is posting a multipart form. I'm hoping that the problem can be duplicated without looking at my code, but if code is required, I can work up a smaller bit of code that demonstrates the problem.
Version
1.17.1
What environment are you running pdf-lib in?
Browser
Checklist
[X] My report includes a Short, Self Contained, Correct (Compilable) Example.
[X] I have attached all PDFs, images, and other files needed to run my SSCCE.
What were you trying to do?
I am generating a file input part of a multipart form via PDFDocument.save() (adding the part via FormData.append()). On the server, I'm trying to open the received pdf file with pdfBox. I'm getting the following error.
Caused by: java.io.IOException: Missing root object specification in trailer. at org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2947) ~[pdfbox-2.0.26.jar:2.0.26]
The exception says that the specification is missing in the trailer but when I look at the data that was uploaded, the trailer is completely missing.
Is there some parameter that I can send to save() to make sure the trailer dictionary is produced?
How did you attempt to do it?
I created browser-side javascript that is saving the pdf content (via PDFDocument.save()) to an array that is being posted to a server as part of a multipart form.
What actually happened?
In my server code, when I try to read the posted pdf document, pdfBox gives me this exception:
Caused by: java.io.IOException: Missing root object specification in trailer. at org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2947) ~[pdfbox-2.0.26.jar:2.0.26]
What did you expect to happen?
I expected pdfBox to be able to open the document.
How can we reproduce the issue?
The code is not short to do this, since an ajax call is being made that is posting a multipart form. I'm hoping that the problem can be duplicated without looking at my code, but if code is required, I can work up a smaller bit of code that demonstrates the problem.
Version
1.17.1
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response