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

Revert file

New Here ,
Dec 07, 2017 Dec 07, 2017

Hello,

I'm wondering how to revert a pdf file to last saved version via javascript.

Any suggestions would be much appreciated.

Thanks in advance, M.

TOPICS
Acrobat SDK and JavaScript
745
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 ,
Dec 07, 2017 Dec 07, 2017

Close without save and re-open the document.

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 ,
Dec 07, 2017 Dec 07, 2017

Ha ha Good one!

I always thought it would be a cool to write backup tool for the internal PDF saves. Never had time though. 

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
Community Expert ,
Dec 08, 2017 Dec 08, 2017

var filePath = this.path;

this.closeDoc(true);

app.openDoc(filePath);

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
LEGEND ,
Dec 08, 2017 Dec 08, 2017

Will the script continue to execute after the document is closed?

I'm pretty sure the actual implementation of revert is much like this except

- note page number, page view, window size and position, and current viewing options

- close without saving

- reopen

- restore page number, page view, window size and position, and current viewing options

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 ,
Dec 08, 2017 Dec 08, 2017
LATEST

Should be, yes.

Restoring the view state is possible, but only if the file is disclosed. Otherwise the openDoc command will not return a reference to it so it won't be possible to manipulate it after re-opening it.

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