applyAllCachedChanges does not work

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

RudolfErnst
User
Posts: 73
Joined: Tue Oct 14, 2008 2:14 pm

applyAllCachedChanges does not work

Post by RudolfErnst »

Hi,
I'm using the ActiveX Control of PDF XChange Viewer in an Eclipse RCP application. In order to avoid flickering of the display I cache my changes done after openDocument with PXCVA_NoApply. After calling applyAllCachedChanges nothing happens, nothing is displayed.

In my special case I open a document with PXCVA_NoApply, zoom the document and then applyAllCachedChanges. Nothing however happens. If i open the document without caching changes everything works fine but with flickering.

Was anybody successful in doing this?
regard
Rudi
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2449
Joined: Thu Jun 30, 2005 4:11 pm

Re: applyAllCachedChanges does not work

Post by Vasyl - PDF-XChange »

I cannot reproduce this trouble. ApplyAllCachedChanges works properly in my test application.
Can you send small part of your code for reproduce it?

Thanks.
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.
RudolfErnst
User
Posts: 73
Joined: Tue Oct 14, 2008 2:14 pm

Re: applyAllCachedChanges does not work

Post by RudolfErnst »

Hi Vasyl,

I open my documents with

Code: Select all

    public void openDocument(String pFilename, boolean cacheChanges) throws ViewerException {
    	if (cacheChanges)
    		getAutomation().invoke(getId("OpenDocument"), new Variant[] { new Variant(pFilename) }, new int[] {1});
    	else
            getAutomation().invoke(getId("OpenDocument"), new Variant[] { new Variant(pFilename) });
    }
This works fine without caching and seems also ok with caching.
I apply my changes with

Code: Select all

    public void applyAllCachedChanges() throws ViewerException{
	doVerb (null, "ApplyAllCachedChanges", new Variant(), new Variant() ,0);
//      getAutomation().invoke(getId("ApplyAllCachedChanges"), new Variant[] { new Variant() });
    }
Neither doVerb nor invoke work properly, nothing is displayed in the view. Maybe I'm using the wrong parameters, I hate these Variants.

Because at the moment I only cache the setting of a zoomfactor, I tried to set the PageDisplay.DefaultZoom Property before opening the document. This however does not work immediately but after 20-30 seconds. In my application there is an auto display function which displays one document per second (sorry, this is a user requirement). If I change the zoomFactor and start this function I see a flickering because openDocumet uses the old DefaultZoom (despite the new one set before each openDocument) and after open I set the new zoomFactor. After some documents, maybe 20, the flickering has gone because PDFXChange uses now the new defaultZomm which is the same I set after open.

I'm a bit confused now because everything I touch at moment goes wrong. Hope you can help me.

regards
Rudi
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2449
Joined: Thu Jun 30, 2005 4:11 pm

Re: applyAllCachedChanges does not work

Post by Vasyl - PDF-XChange »

In your case you can try (without caching changes of properties):
// setup custom initial zoom, pages layout
// for deny restore zoom, pages layout(single, contionuous, etc) from recents
setProperty("Documents.RestoreLastPageDisp", 0);
setProperty("PageDisplay.DefaultZoom", 300); // or setProperty("PageDisplay.DefaultZoom", "FitPage");
setProperty("PageDisplay.DefaultLayout", "SinglePage");
// and optional
// for deny restore document's panes visibility (bookmarks, thumbnails, etc) from recents
setProperty("Documents.RestoreLastView", 0);
setProperty("PageDisplay.DefaultView", "PageOnly");

// open document(s) with specified initial view settings
openDocument(filename1);
openDocument(filename2);
...

Also some commets:
Because at the moment I only cache the setting of a zoomfactor, I tried to set the PageDisplay.DefaultZoom Property before opening the document.
This however does not work immediately but after 20-30 seconds.
Possible reason for problem with PageDisplay.DefaultZoom: probably you use flag PXCVA_NoApply(1) at setProperty. Do not use this flag at change of this property.
This property should be actual(not cached) before document opening.
Also usage flag PXCVA_NoApply(1) for openDocument has no effect. This flag works for changing of simple properties only.

Thanks for your posts.
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.
RudolfErnst
User
Posts: 73
Joined: Tue Oct 14, 2008 2:14 pm

Re: applyAllCachedChanges does not work

Post by RudolfErnst »

Thanks Vasyl,

setProperty("Documents.RestoreLastPageDisp", 0);

did it.

By the way, is there anywhere a list of all this undocumented but very useful properties?

kind regards
Rudi
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2449
Joined: Thu Jun 30, 2005 4:11 pm

Re: applyAllCachedChanges does not work

Post by Vasyl - PDF-XChange »

Info about this option (and some others) will be added into SDK Help for next build.
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.
RudolfErnst
User
Posts: 73
Joined: Tue Oct 14, 2008 2:14 pm

Re: applyAllCachedChanges does not work

Post by RudolfErnst »

Hello Vasyl,

I think I have to reopen this posting. What do you mean with
Vasyl-Tracker Dev Team wrote: Also usage flag PXCVA_NoApply(1) for openDocument has no effect. This flag works for changing of simple properties only.
Currently I'm working on the my screen flickering problem again. I want to open a document, set the zoom factor and the rotation. This causes heavy flickering because the document is displayed, then zoomed and then rotated. How can this be done in one step?

kind regards
Rudi
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2449
Joined: Thu Jun 30, 2005 4:11 pm

Re: applyAllCachedChanges does not work

Post by Vasyl - PDF-XChange »

It is impossible in current realization. In this case you can setup custom zoom factor before open document(as discussed above).
The new property 'PageDisplay.DefaultRotation' will be added into the next build.
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.
RudolfErnst
User
Posts: 73
Joined: Tue Oct 14, 2008 2:14 pm

Re: applyAllCachedChanges does not work

Post by RudolfErnst »

Hello,

would it also be possible to have a property for a default scroll position (via view state)?

regards
Rudi
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: applyAllCachedChanges does not work

Post by Ivan - Tracker Software »

It depends for which purposes you need this position.
If for store/restore state - yes, we can provide it (even now you can use doc.viewState property via JavaScript).
But if for navigation through the document - no, not for now.
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.
RudolfErnst
User
Posts: 73
Joined: Tue Oct 14, 2008 2:14 pm

Re: applyAllCachedChanges does not work

Post by RudolfErnst »

Yes it's for store/restore. If I do it with doc.viewState I have to load the document first of all and this causes flickering again. So a default property would be nice.

regards
Rudi