Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Close without save and re-open the document.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
var filePath = this.path;
this.closeDoc(true);
app.openDoc(filePath);
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.