On Thu, 2006-02-02 at 13:13 -0600, Dan McKeon wrote:
> 
> I am writing a program to convert an input file to PDF.  Is there a
> way to examine the input file to determine if it already is PDF? 

Depending on which environment you are working with, there are various
options. The lowlevel approach is to check the first bytes of the
document, excerpt from /etc/mime-magic for PDF:

-------CUT------
[...]
0       string          %PDF-           PDF document
[...]
-------CUT------

That tells us that PDF documents start with the string "%PDF-"

One other option is to use the file command available on many unixes:

% file test.pdf
test.pdf: PDF document, version 1.4

regards

Udo Rader

-- 
BestSolution.at EDV Systemhaus GmbH
http://www.bestsolution.at

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to