BeforeCloseDoc question

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

TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

BeforeCloseDoc question

Post by TatianaS »

Hello,
I am using the latest build of ActiveX component in delphi and tried to run this code inside onEvent

if (Name = 'Notifications.BeforeCloseDoc') then begin
SetProperty('Notifications.BeforeCloseDoc.CancelAllowed', 1, 0);
SetProperty('Notifications.BeforeCloseDoc.Cancel', 1, 0);
end;

CancelAllowed gives me an exceptions and without it even when cancel flag set to 1 the document is still closing.
What is missing?


Thanks,
-Tatiana
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: BeforeCloseDoc question

Post by Stefan - PDF-XChange »

Hi TatianaS,

Looking at this:
Viewer v2.5 ActiveX SDK > Reference > Named Items > Objects > Notifications > BeforeCloseDoc
It seems that CancelAllowed is a read only property and that's why you are getting that exception.

As for actually interrupting the document closing - it works for me in C# using the full demo and the latest Viewer build with the following code

Code: Select all

if (e.name == "Notifications.BeforeCloseDoc"){
    try
    {
        axCoPDFXCview1.SetProperty("Notifications.BeforeCloseDoc.Cancel", 1, 0);
    }
    catch (Exception) { }
}