Skip to main content
daitranthanhoa
Inspiring
January 25, 2019
Answered

How can detect PDF version by js or IAC?

  • January 25, 2019
  • 1 reply
  • 1608 views

PDF file has version 1.5,1.6,1.7

I had try get in Info object , but it not exist:

console.println( this.info.toSource());

How can detect PDF version by js or IAC?

Thank you.

This topic has been closed for replies.
Correct answer Thom Parker

The PDF version is not in the "info" object or the PDF metadata.  I don't think it's accessible from the IAC either.

The only place you can find the PDF version is in the first 9 bytes of the PDF file.  Fortunately there is an undocumented JS method that provides access to the binary file data.

var stmDoc = Collab.documentToStream(this);

var pdfVer = util.stringFromStream(stmDoc).substr(5,3);

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 25, 2019

The PDF version is not in the "info" object or the PDF metadata.  I don't think it's accessible from the IAC either.

The only place you can find the PDF version is in the first 9 bytes of the PDF file.  Fortunately there is an undocumented JS method that provides access to the binary file data.

var stmDoc = Collab.documentToStream(this);

var pdfVer = util.stringFromStream(stmDoc).substr(5,3);

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
daitranthanhoa
Inspiring
January 25, 2019

Thank you.