The PDF reference (available on the Adobe website) is the best way to answer questions like this.
Section 3.4.1 File Header says that a valid PDF will always start with a line like "%PDF−1.5" (obviously the exact version may be different). Of course, this won't tell you if the content is valid, but should be enough to indicate that it's supposed to be a PDF. Tony S. DoubleCrest wrote: > > Hi Guys, > > Is there an API that I can use to determine if a file is valid PDF file. > > We have an application that receives and processes PDF files. Currently we > use file name to determine if we should process a file, i.e if filename is > xxx.pdf, we will going to process it, otherwise, just ignore it. > > However, sometimes user sends in a valid pdf file but named it with > something like xxxx.pdf.06092008, - Is there way using API so that we can > determine if the file is a valid pdf file? > > Thanks a lot! > > WMC > > -- View this message in context: http://www.nabble.com/How-to-determine-if-a-file-is-valid-PDF-file-tp17743665p17744293.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar
