How to get PDF documents version (1.4, 1.6 ...etc..)

Q: How to get PDF documents version (1.4, 1.6 ...etc..)


You could use:

// C++
string pdfversion = pdfdoc.GetSDFDoc()->GetHeader();

// C#
String pdfversion = pdfdoc.GetSDFDoc().GetHeader();

GetHeader returns the header string identifying the document version to
which the file conforms. For a file conforming to PDF version 1.4, the
header should be %PDF-1.4. In general header strings have the
following syntax: %AAA-N.n where AAA identifies document specification
(i.e. PDF), N is the major version and n is the minor version. The new
header string can be set during a full save (see SDF::Doc::Save()). For
a document that is not serialized the function returns an empty string.