How to be notified during an annotation addition?
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 216
- Joined: Thu Jul 08, 2004 7:29 pm
How to be notified during an annotation addition?
I need to set the Author, Subject, and the display format of the Created/Modified date/time as an annotation is being created - I do not want to use the defaults of the logged in NT user account. How do I receive an event that I can immediately drop into JavaScript and update those fields before the user ever sees them? Or must I do this at time of saving the document?
-
- User
- Posts: 664
- Joined: Tue Nov 14, 2006 12:23 pm
Re: How to be notified during an annotation addition?
Hi DSSavant,
For now we do not have any event that annotation was added to the document.
However you can set default Author property for commenting tools by specifying "Identity.Name" property
HTH.
For now we do not have any event that annotation was added to the document.
However you can set default Author property for commenting tools by specifying "Identity.Name" property
Code: Select all
CoPDFXCview1.SetProperty("Identity.Name", "Some Name", 0)
-
- Site Admin
- Posts: 2448
- Joined: Thu Jun 30, 2005 4:11 pm
Re: How to be notified during an annotation addition?
Also, you may use Java-Script for this(by RunJavaScript routine), for example:
For details see http://www.adobe.com/devnet/acrobat/pdf ... erence.pdf.
HTH
Code: Select all
// to change subject/author info for all Sticky Notes in current document:
var annots = this.getAnnots();
for (i = 0; i < annots.length; i++)
{
var a = annots[i];
if (a.type == "Text")
{
a.subject = "Review";
a.author = "I'm";
};
}
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 216
- Joined: Thu Jul 08, 2004 7:29 pm
Re: How to be notified during an annotation addition?
The SetProperty is exactly what I truly need. I will set the value before any annotations are created thereby getting around the notification. Thanks.
-
- Site Admin
- Posts: 2448
- Joined: Thu Jun 30, 2005 4:11 pm
Re: How to be notified during an annotation addition?
Hi, DSSavant.
The features like as:- will be added into the new version(V3).
The features like as:
Code: Select all
SetProperty("Commenting.StikyNote.DefaultSubject", "MySubject", 0);
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 216
- Joined: Thu Jul 08, 2004 7:29 pm
Re: How to be notified during an annotation addition?
Two items:
A) Could you please tell me where in the SDK document to find the following command name (Identity.Name) and how to use DoVerb to accomplish the same thing:
B) When you guys add the:
capabilities, please please please please expose as many properties as possible like color, author, ...
Thanks!
A) Could you please tell me where in the SDK document to find the following command name (Identity.Name) and how to use DoVerb to accomplish the same thing:
Code: Select all
CoPDFXCview1.SetProperty("Identity.Name", "Some Name", 0)
Code: Select all
SetProperty("Commenting.StikyNote.DefaultSubject", "MySubject", 0);
Thanks!
-
- Site Admin
- Posts: 2448
- Joined: Thu Jun 30, 2005 4:11 pm
Re: How to be notified during an annotation addition?
We will add description for undocumented "Identity" section.Could you please tell me where in the SDK document to find the following command name (Identity.Name) and how to use DoVerb to accomplish the same thing:
CoPDFXCview1.SetProperty("Identity.Name", "Some Name", 0)
Also, we will add this new feature into the next build:
Code: Select all
SetProperty("Commenting.StikyNote.Styles[<StyleIndexOrID>].Subject", "MySubject", 0); // custom subject
SetProperty("Commenting.StikyNote.Styles[<StyleIndexOrID>].UseSubject",
"true", 0); // to use custom subject at new comment creation or style applying.

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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 7
- Joined: Thu Jul 16, 2009 12:31 am
Re: How to be notified during an annotation addition?
Is "New Annot" notification planned for future?
-
- User
- Posts: 7
- Joined: Thu Jul 16, 2009 12:31 am
Re: How to be notified during an annotation addition?
In case anyone can use it here is a workaround, in Delphi, that seems to be doing the trick.
If you see a problem with relying on this please let me know.
Thanks
Code: Select all
public
MouseUpOccuredSinceLastMouseMove: boolean;
MouseUpPage: integer;
procedure TForm1.CoPDFXCview1Event(ASender: TObject; Type_: Integer;
const Name: WideString; const DataIn: OleVariant; out DataOut: OleVariant;
Flags: Integer);
var
P: TPoint;
msg:integer;
str:string;
vDataIn,vDataOut:OleVariant;
spMouse, spContextMenu: IPDFXCsmartp;
nDocID:integer;
vArr:array of OLEVariant;
dx,dy:double;
Script,Result: widestring;
begin
if (type_ = PXCVA_OnNamedNotify) and (Name = 'Notifications.Mouse') then
begin
try
CoPDFXCview1.DoVerb('Notifications.Mouse', '.SP', vDataIn, vDataOut, 0);
spMouse:=IDispatch(vDataOut) as IPDFXCsmartp;
except
exit;
end;
spMouse.GetProperty('Page', vDataOut, 0); MouseUpPage := vDataOut;
if (MouseUpPage >= 0) then
begin
spMouse.GetProperty('msg', vDataOut, 0); msg := vDataOut;
if msg = WM_LBUTTONUP then
begin
MouseUpOccuredSinceLastMouseMove := True;
end else if MouseUpOccuredSinceLastMouseMove then
begin
Result := '';
try
Application.ProcessMessages;
Script := 'var OutStr = "None"; var AnnotsOnPage = this.getAnnots('+IntToStr(MouseUpPage)+');'
+'if (AnnotsOnPage != null) OutStr = AnnotsOnPage.length; OutStr;';
CoPDFXCview1.RunJavaScript(Script,Result,0,0);
except ShowMessage('This JavaScript Failed' +#13#10+ Script); end;
Memo1.Text := Result;
MouseUpOccuredSinceLastMouseMove := False;
end;
end;
end;
end;
Thanks
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to be notified during an annotation addition?
Thanks for the example millerna,
I hope it will be put to good use by another of our developing colleagues out there developing with PDF XChange.
Regards,
Stefan
I hope it will be put to good use by another of our developing colleagues out there developing with PDF XChange.
Regards,
Stefan