Page 1 of 1

Receive notification when doc finished loading

Posted: Mon Aug 21, 2017 7:43 pm
by dkeith2
Is there an event, callback or any other means of being notified when a document is finished loading?

I've been getting access violations if I try to write to form fields when the document is still loading.

If I wait for a large document to load, usually I won't get any access violations when attempting to write data to form fields.

Re: Receive notification when doc finished loading

Posted: Tue Aug 22, 2017 8:08 am
by Sasha - Tracker Dev Team
Hello dkeith2,

Try e.document.initialized or e.document.viewingStarted event.

Cheers,
Alex

Re: Receive notification when doc finished loading

Posted: Tue Aug 22, 2017 9:14 pm
by dkeith2
Thanks. e.document.initialized seems to do the trick.
On another note, I keep getting invalid floating point operation when I call the following:

Code: Select all

    FStream.LoadFromStream(Stream);
    strm := TStreamAdapter.Create(fstream,TStreamOwnership.soReference);
    OpenDocFrom(strm,null); <====Errors out here
    
What's weird about this error is that it is inconsistent. I can run the app, load the child form from the main form, which in turn loads the control. Then I interactively choose the document to load, and open it - either automatically filling the form fields with data or loading data in a 2 step operation of 1) Open pdf... and 2) write data to fields programmatically.

It works up to a point; then it begins to crash with the invalid floating point operation. Also, loading one document usually works fine with no leaks; after opening and closing a few documents I get memory leaks.

First of all, why an invalid floating point operation?

Before I create the control I call CoInitialize; when I am destroying the form I call CoUninitialize.

Sometimes when I write data to the form fields the display doesn't refresh, or not all of the fields get written. Almost as if the control doesn't completely initialize...

Re: Receive notification when doc finished loading

Posted: Wed Aug 23, 2017 7:33 am
by Sasha - Tracker Dev Team
Hello dkeith2,

Try doing this:
https://forum.pdf-xchange.com/ ... 15#p103115
Also, this wiki help page here is very useful:
https://sdkhelp.pdf-xchange.com/view/PXV:CoClasses

Cheers,
Alex