Attachment Pane

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

docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Attachment Pane

Post by docu-track99 »

Is there any way to get the name of the attachment, or it's "id" in the attachment list, or the destination that the file is going to be moved too when it's opened, when a user opens an attachment from the attachment pane?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Attachment Pane

Post by Vasyl - PDF-XChange »

Look to our SDK Help:

You may use the following new feature (available from 200 build onwards) - a named notification "Notifications.BeforeOpenAttachment". Example code-snippet:

Code: Select all

youreventhandler OnEvent(type, name...)
{
     if ((type == PXCVA_OnNamedNotify) AND (name == "Notifications.BeforeOpenAttachment"))
     {
          int srcDocID;
          pdfViewer.GetProperty(name + ".OwnerDocID", out srcDocID);
          string attachmentName; 
          pdfViewer.GetProperty(name + ".Name", out attachmentName);
          string attachmentFileName; // extracted temp. file name
          pdfViewer.GetProperty(name + ".FileName", out attachmentFileName);
          int bIsPDF; // boolean
          pdfViewer.GetProperty(name + ".IsPDF", out bIsPDF);
          if ((bIsPDF != 0) AND (attachmentName == "MyAttachment"))
          {
                pdfViewer.SetProperty(name + ".MakeReadOnly", "true"); // to make read-only the pdf-document, opened from this attachment
                // or  
                // pdfViewer.SetProperty(name + ".Cancel", "true"); // to cancel opening this attachment
          }
     }
}
Sorry, this feature is undocumented temporarily...

Also look at the [Reference/Named Items/Objects/Documents/<Item>/<Methods>] location for the GetAttacmentsCount, GetAttacmentName, etc. methods...

HTH.
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.