Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can detect PDF version by js or IAC?

Enthusiast ,
Jan 24, 2019 Jan 24, 2019

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.

TOPICS
Acrobat SDK and JavaScript
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 24, 2019 Jan 24, 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);

Translate
Community Expert ,
Jan 24, 2019 Jan 24, 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 24, 2019 Jan 24, 2019

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 25, 2019 Jan 25, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2019 Jan 25, 2019
LATEST

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

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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