The quick and dirty way to determine the version of a
PDF file is parsing the first line from
PDF Document File Header (See
PDF reference[
^],
'7.5.2 File Header',
p.39).
According to specification:
'The first line of a PDF file shall be a header consisting of the 5 characters %PDF– followed by a version number of the form 1.N, where N is a digit between 0 and 7.'
You can check out this by simply opening the content of a
PDF file in text editor (f.e. I use Notepad++) and see the first line. The version numbers should be there, right after '%PDF–'.
This method is very simple and does not require additional libraries and SDKs, you can easily read and parse the first line of a
PDF file using
C#. But keep in mind that not all of the PDF documents are standard conforming and
Adobe Reader often opens these documents too. So if you need a stable version check for all PDF files better use an additional PDF library. For such libraries you can check out
this[
^].
P.S. You say:
'If it's an older version of PDF it doesn't open....'
This is not very clear. What is this program that could not open older
PDF versions. Is it Adobe Reader?
And also which versions you determine as 'older':
VER < 1.2,
VER < 1.5 or
VER < 1.7?
It is better to elaborate a bit about this issues.
[Update]
After reading your question for second time I realized that you didn't clarified what your phrase 'version of PDF' exactly means. First I thought that it refers to the version of the PDF file. Now I think that you could also want to check the PDF Reader version of your clients. If this is the case, have a look
here[
^] for determining if Adobe Reader is installed and if yes, which version is.
Sorry your question is not very clear to me and I've tried to cover both PDF file version and PDF reader version.
[/Update]