Quantcast

PDF Header signature not found

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PDF Header signature not found

tmiddlebrook
I am getting the PDF header signature not found error. I seen in some posts I need to add "%PDF-1." and some post say I need to subtract "%PDF-1". What do I need to do to get rid this error? Either on the code side or on the pdf side. The file I am using works sometimes but sometimes it throws this error. Any suggestions?

Thanks in Advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

info-2
tmiddlebrook wrote:
> I am getting the PDF header signature not found error. I seen in some posts I
> need to add "%PDF-1." and some post say I need to subtract "%PDF-1". What do
> I need to do to get rid this error? Either on the code side or on the pdf
> side. The file I am using works sometimes but sometimes it throws this
> error. Any suggestions?

When you get such an error, you are trying to open a file that IS NOT A
PDF. You may think you have created a PDF, you may even have created a
PDF, but you are not opening a PDF.

Please explain the context.

For instance: if you are creating a PDF in a web application, the PDF
may have been created on the server, but the server is definitely
sending something else to the browser.

Most likely the server is sending a HTML page, for instance with a 500
error message. Please read chapter 9 in the 2nd edition of iText in
Action and go over all the rules of thumb to see what could have gone wrong.

------------------------------------------------------------------------------
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
[hidden email]
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

tmiddlebrook
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. 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. I am not creating a pdfs just trying to read its contents, and attributes of the pdf.

Any Suggestions?

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

info-2
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
[hidden email]
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

tmiddlebrook

I opened the file in notepadd++ and the first line is %PDF-1.7. I will check to make sure I am pulling out the correct variabels from the input stream. But do I understand it correctly do I need to remove %PDF-1.7 or do I need to add something to that string?


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

HAHAHA, I guess I should have expected that one.

Thanks :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

info-2
tmiddlebrook wrote:
>
> I opened the file in notepadd++ and the first line is %PDF-1.7. I will check
> to make sure I am pulling out the correct variabels from the input stream.
> But do I understand it correctly do I need to remove %PDF-1.7 or do I need
> to add something to that string?

If it starts with "%PDF-1.7" then you have a correct PDF, and the
exception "PDF header signature not found error" shouldn't occur.

What if you use that PDF in a standalone example?
Does the error occur then? (If so, send us the PDF.)

------------------------------------------------------------------------------
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
[hidden email]
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

tmiddlebrook
In reply to this post by tmiddlebrook
I will try that solution.

Thanks for everything.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

tmiddlebrook
Let me first say thank you for all your help. I wasn't using the correct variable within the IO Stream. I was checking the sizes and thought I was using the correct variable but I wasn't. Again Thanks for all your help. As thanks I will purchase another copy of your itext book (the ebook version).

Ray
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

Ray
This post has NOT been accepted by the mailing list yet.
Hi,

Could you please explain why the Stream error sometimes caused the PDF to threw exception but sometimes it worked? ( I would expect a consistent behavior, i.e. always throw an exception..)

Regards,
Ray.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

itext2012
Hi

I am also getting this error. Let me explain what i am doing.

I need to merge 100 pdf files into single pdf file and that single pdf is
created dynamically. when there is no single pdf file present in the folder
it will get created. But if there is already one then i am deleting it and
creating another with same name.This is where i am getting this error.

An Error occurred while merging the PDF files PDF header signature not
found.
An Error occurred while closing the Document The document has no pages.


thanks in advance.




--
View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Header-signature-not-found-tp2330180p4633140.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF Header signature not found

Alexis Pigeon
Hi itext2012,

On 14 May 2012 23:10, itext2012 <[hidden email]> wrote:
Hi

I am also getting this error. Let me explain what i am doing.

I need to merge 100 pdf files into single pdf file and that single pdf is
created dynamically. when there is no single pdf file present in the folder
it will get created. But if there is already one then i am deleting it and
creating another with same name.This is where i am getting this error.

An Error occurred while merging the PDF files PDF header signature not
found.
An Error occurred while closing the Document The document has no pages.

Please don't hijack an old thread, create your own, and if needed, make a reference to this one.
In your new thread, remember to add standalone code sample so that we can reproduce the error.
As you already know, crystal balls are broken.

Cheers,
alexis

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
Loading...