Snapshot coordinates

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

devries48
User
Posts: 3
Joined: Fri Aug 22, 2014 1:44 pm

Snapshot coordinates

Post by devries48 »

Hi,

I'm working on a tool that must extract text from a selected area (rectangle).
It would be nice if I could draw a selection rectangle like the snapshot- or zoomtool uses and get the coordinates of that rectangle and also get a notification when that rectangle is changed.

I don't think it's possible. if so, is it possible to use the snapshot tool and get the information from that rectangle when a snapshot is taken?

Any help would be appreciated.

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

Re: Snapshot coordinates

Post by Vasyl - PDF-XChange »

Hi, Ronald.

You may use next trick:

1. set one Viewer's options:

Code: Select all

pdfViewer.SetProperty("Commenting.CopySelTextToDrawingPopup", true, 0);
// == [Menu/Edit/Preferences/Commenting] tab,  "Copy encircled text into Drawing comment popups"
2. activate new annot creation events:

Code: Select all

pdfViewer.SetProperty("Notifications.NewAnnotAdded.Enabled", true, 0); 
2. handle the new annots creation event:

Code: Select all

OnEvent(type, name..)
{
      if ((type == PXCVA_OnNamedNotify) AND (name == "Notifications.NewAnnotAdded"))
      { 
           object pageIdx; 
           object annotName; 
           pdfViewer.GetProperty("Notifications.NewAnnotAdded.Name", out annotName, 0);
           pdfViewer.GetProperty("Notifications.NewAnnotAdded.PageIndex", out pageIdx, 0);
           string script = "var a = this.getAnnot(" + pageIdx.ToInt() + ", \"" + annotName.ToString() + "\"); if (a != null) a.contents;";
           string scriptRes;
           pdfViewer.RunJavaScript(script, out scriptRes, 0, PXCVA_NoUI);
           scriptRes; // text under any drawing annot, such as "Square", "Circle", "Polygon" etc..
      }  
}
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.
devries48
User
Posts: 3
Joined: Fri Aug 22, 2014 1:44 pm

Re: Snapshot coordinates

Post by devries48 »

Thanks for the quick response, this is a lot faster than my ".Text.Chars", ".SP" method.
I noticed that the contents of the annotation is not updated when I resize the annotation but we can do without that functionallity (for now :) ).

b.t.w. Is het possible to change the mouse cursor or even beter use a custom cursor?
So the user can see a difference between drawing an annotation or selecting an area.

Best regards,
Ronald
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Snapshot coordinates

Post by Stefan - PDF-XChange »

Hi Ronald,

No this is not possible in the Viewer AX SDK.

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

Re: Snapshot coordinates

Post by Vasyl - PDF-XChange »

Hi, Ronald.
I noticed that the contents of the annotation is not updated when I resize the annotation but we can do without that functionallity (for now :)
No, option "Commenting.CopySelTextToDrawingPopup" works only for comments creating, not for editing..

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