ReDo / UnDo

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

ReDo / UnDo

Post by relapse »

Hello, a new question...

In my program I often use the JavaScript statement (command)

Code: Select all

this.getPageBox("Crop", this.pageNum);
Why doesn't this command work after Undo action? Is there no CropBox at all in any of old states of a document?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: ReDo / UnDo

Post by Stefan - PDF-XChange »

Hello Relapse,

We just discussed this with one of my colleagues, and he advised that this JS method should work, but using it after undo/redo could cause unpredictable results.
We will see if we can get some further info here.

Best,
Stefan
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: ReDo / UnDo

Post by relapse »

The other option is to work with temporary files, then you'll have this CropBox for sure and you can e.g. crop a selected area from one of previous states. Since there is this function on the navigation bar, it would be easier to use this native one...
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: ReDo / UnDo

Post by Ivan - Tracker Software »

Can you let me know which operation is undoing? As I see on my side this js snippet always works.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: ReDo / UnDo

Post by relapse »

The operations I do are: cropping an area out of a document (after that action you see the cropped area as a new document), putting a border around a document (an annotation in form of a rectangle is created), scaling it. That's all.
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: ReDo / UnDo

Post by relapse »

Now I'm trying to implement the functionality with the Memento pattern. The problem is, if I load a document having several pages and then cut out an area of it, I delete the rest of pages. How could I reverse deleting pages? How is that issue solved in your application programatically?


Thanx
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: ReDo / UnDo

Post by Vasyl - PDF-XChange »

Hi, relapse.

Sorry, it is impossible because the 'delete pages' operation is irreversible currently - you may only re-open document without saving.
But you will be able to undo it in the new version of this SDK - V3. Please wait..

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.