Reputation: 361
I am converting a PDF file using QPDF , this pdf file is uploaded by a jsp page ,
this is my command (in Ubuntu)
'qpdf --qdf ~/apache-tomcat-7.0.22/bin/733000.pdf /tmp/testP.pdf'
when i run this it says :
~/apache-tomcat-7.0.22/bin/733000.pdf: not a PDF file
but
when i run this command to same PDF file without upload it , then there is no error
I'am using QPDF version 2.2.2 What can be the reason ?
Thanks
Upvotes: 0
Views: 1198
Reputation: 8868
As from the comments, let me propose an answer for you.
The file in the temporary location is not the exact file you upload. Are you doing the fileItem.write(fileOb)
in the servlet you handle upload?. May be you can just have a look at this link, and find out how they handle this condition.
http://www.tutorialspoint.com/servlets/servlets-file-uploading.htm
If it was not done properly, the source file is corrupted as we look from point of a PDF handler.
EDIT:
Also as an alternative , try using Apache Commons File Upload
Thanks
Upvotes: 2