Access new added annotation source when pasted in a document

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Access new added annotation source when pasted in a document

Post by MartinCS » Wed Dec 20, 2017 9:28 am

Hi Tracker-Team,

I came accross an issue I had with the PDF-XChange Viewer SDK once, see related post: https://www.tracker-software.com/forum3 ... 421#p77421

The solution was that you guys created a new PXCVA_EventType named "Notifications.NewAnnotAdded" which also made it possible to read the property "Notifications.NewAnnotAdded.Source":

Code: Select all

If (e.type = PDFXCviewAxLib.PXCVA_EventTypes.PXCVA_OnNamedNotify) And (e.name = "Notifications.NewAnnotAdded") Then
' get window id
AxCoPDFXCview1.GetActiveDocument(nDocID)

' get source of new annot
AxCoPDFXCview1.GetProperty("Notifications.NewAnnotAdded.Source", vDataOut)

' new annot created
If (vDataOut = 0) Then ...

' pasted annot by user
If (vDataOut = 1) Then ...
Is there already a similar property/way in the Editor SDK? If not, is there a chance that you create a source property for the IPXC_Annotation Interface (https://sdkhelp.tracker-software.com/vi ... Properties)?

Thank you!

// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Wed Dec 20, 2017 10:00 am

Hello Martin,

You can catch the https://sdkhelp.tracker-software.com/vi ... s_inserted event and get the annotations list from there.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Wed Dec 20, 2017 10:39 am

Hi Alex,

I registered my application to the "e.annots.inserted" event and I'm also able to iterate the annotation list. But I can't find a property of the annotation which tells me if it was pasted by the user or created as a new annotation.

For me it is essential to know if the user pasted a already existing annotation of if the user created a new one.

// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Wed Dec 20, 2017 10:59 am

Hello Martin,

Please clarify what do you mean by pasting an existing one.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Wed Dec 20, 2017 12:42 pm

Alex,

in our application and implemantation of the PDF Editor I do load pdf documents with annotions which different users created at different/earlier times. The current user of the pdf document can see all these annotations on the pdf document and he has the possibility to copy and paste these annotations. This is where I need to know if the new annot was created from scratch or was an existing annot.

For the Viewer SDK you guys implemented the notify event and property which I mentioned and refered in my initial post. Now, that I'm working on the implementation of the Tracker Editor in our application I do need the same functionallity.

// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Wed Dec 20, 2017 12:49 pm

Hello Martin,

Well, you can always catch the https://sdkhelp.tracker-software.com/vi ... oreExecute event and see whether it's an insert annotation operation. If so, mark this with some class-level boolean value and look for it in the event I mentioned before. This should work.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Wed Dec 20, 2017 12:59 pm

Hi Alex,

as far as I understand the Editor SDK there are five events I can register for annot operations:
  • e.annots.changed
    e.annots.deleted
    e.annots.inserted
    e.annots.visibilityChanged
    e.annotStateModelsChanged
And the "e.annots.instered" event is the only one which makes sense (like you suggested earlier). But my problem is that I'm not able to differ from an annot which is a new one and an annot which has been pasted. On both options the e.annots.inserted event is triggered which does not give me any further information about the annot except of IPXC_Annotation properties.

// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Wed Dec 20, 2017 1:01 pm

Hello Martin,
Well, you can always catch the https://sdkhelp.tracker-software.com/vi ... oreExecute event and see whether it's an insert annotation operation. If so, mark this with some class-level boolean value and look for it in the event I mentioned before (e.annots.inserted). This should work.
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Thu Dec 21, 2017 12:09 pm

Hi Alex,

I'm sorry, but I still don't see a chance to differ if an annot was created or inserted (using copy and paste). The registered event for "e.annots.inserted" is fired every time and the eventId is always the same (value: 2478). I don't have a source property inside of the IPXC_Annotation object or the event object. This makes it impossible to check if the annot was copied or created.
21-12-_2017_12-55-24.jpg
21-12-_2017_12-53-35.jpg
Is there another option to get the source of the inserted annot (like it was in the PDF-XChange Viewer)?

// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Thu Dec 21, 2017 12:54 pm

Hello Martin,

Hmm, how about distinguishing them by the Creation Date then? This should work for you.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Thu Dec 21, 2017 1:09 pm

Alex,

don't you see a chance to add a new property 'source' to the IPXC_Annotation object similar you guys did it for the Viewer SDK?

// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Thu Dec 21, 2017 1:13 pm

Hello Martin,

Well we will think whether we can add a property like this. For the meanwhile - try using the date method - should work smoothly for you.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Thu Dec 21, 2017 1:27 pm

Hello Alex,

that would be awesome of you guys! Thank you!

Meanwhile, I will try your suggestion and keep this post open and will check back on it the next period of time.

// Martin

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13651
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Access new added annotation source when pasted in a document

Post by Tracker Supp-Stefan » Thu Dec 21, 2017 1:46 pm

Thanks Martin!

keep us posted on how it goes with the suggestion!

Cheers,
Stefan

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by MartinCS » Mon Jan 29, 2018 7:55 am

Hi Alex,

your suggestion doesn't work because I found another issue when copying an existing annotation. The creation date of the copy is not updated to the current date as you can see here:
29-01-_2018_08-52-27.jpg
// Martin

User avatar
Sasha - Tracker Dev Team
User
Posts: 4522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Access new added annotation source when pasted in a document

Post by Sasha - Tracker Dev Team » Mon Jan 29, 2018 10:25 am

Hello Martin,

The date itself is being copied along with the annotation - that can give you a hint that it's a copied annotation, not a newly inserted one. The one thing that differs in the copied annotations is the Name of the annotation.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply