How can detect PDF version by js or IAC?

Enthusiast ,
Jan 24, 2019

Copy link to clipboard

Copied

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.

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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);

TOPICS
Acrobat SDK and JavaScript

Views

260

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How can detect PDF version by js or IAC?

Enthusiast ,
Jan 24, 2019

Copy link to clipboard

Copied

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.

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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);

TOPICS
Acrobat SDK and JavaScript

Views

261

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 24, 2019 0
Adobe Community Professional ,
Jan 24, 2019

Copy link to clipboard

Copied

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);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2019 1
Enthusiast ,
Jan 24, 2019

Copy link to clipboard

Copied

Thank you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2019 0
Adobe Employee ,
Jan 25, 2019

Copy link to clipboard

Copied

While A version of the PDF is present where Thom says it is – that can be overridden by data later in the PDF (/Catalog/Version).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 25, 2019 1
Adobe Community Professional ,
Jan 25, 2019

Copy link to clipboard

Copied

Forgot about that one   Tricky stuff, digging into the catalog is much harder.  

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 25, 2019 1