tmiddlebrook wrote:
> This is what I am trying to do. I want to upload a pdf to a database,  but it
> needs be inserted into different tables based on different conditions. For
> example if the pdf is password protected it goes into one table, or if the
> page count is greater than 5 pages it goes into another.

OK, so the end user has an HTML field for file upload and can upload a 
PDF. You get the byte[] on the server side and you feed it to PdfReader, 
but PdfReader complains that the file doesn't start with "%PDF-".

If the file doesn't start with "%PDF-", it's either NOT a PDF file, or 
you aren't extracting the PDF correctly from the InputStream received by 
the HttpRequest.

> Currently I am
> still testing the app, and sometimes the app accepts the pdf and other times
> I am getting the PDF header not found issue. So to repond back to your
> comment, yes it is a pdf, I can open it in adobe.

You can't open it in Adobe, unless you go to San José, California. Adobe 
is a company, not a product ;-)

You can open it in Adobe Reader, but what if you open it in a text 
editor such as Wordpad, Notepad++, vi,...? Does it start with "%PDF-" or 
does it have other characters? Maybe Adobe Reader ignores rubbish that 
is added at the start of the file.

> I am not creating a pdfs
> just trying to read its contents, and attributes of the pdf.
> 
> Any Suggestions?

Save the faulty PDFs.
Look at them in a plain text editor to check if they start with "%PDF-".
Try opening them with PdfReader in a simple standalone application.
If the standalone application produces an error, post the PDF and the 
standalone application.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to