Handling and manipulating stamps

PDF-XChange Editor SDK for Developers

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

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.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Handling and manipulating stamps

Post by docu-track99 »

Hello folks,

I hate to admit I'm having a little difficulty with wrapping my head around annotations, or more specifically, stamps.

The specific problem I'm trying to solve involves a set of 3 special (read: custom) stamps. I am programmatically checking the AppData\Roaming\Tracker Software\Editor\3.0\Stamps folder and if the stamps are not there, I put the stamps in place so that they are always accessible in the editor. The problem is I would like to be able to do things like delete or flatten only these 3 stamps (not all stamps in a document) programmatically.

I have seen samples here on how to delete annotations of one specific type and I know for example how to flatten any annotation of type "Stamp". But traipsing around the Wiki and these forums, I haven't yet been able to figure out how handle and manipulate these specific 3 stamps which are part of a stamp collection called "Signatures". The stamps are called Red, Blue and Green, however, as far as I can tell, this is represented neither by annot.Title nor by annot.Name properties.

Banging my head doesn't seem to be producing any results. How can I go about programmatically detecting when any of these 3 specific stamps are added to the document, so that I can manipulate them accordingly. Any help/direction is greatly appreciated!

Edit: Also, I've since tried creating a stamp collection and using the AddStamp(s) methods to add the stamps manually, giving me more control over them since I know immediately how to identify them. I wasn't able to get this to work either, here is my code:

Code: Select all

    Private Sub LoadStamps()
        Dim xcInst As PDFXEdit.IPXC_Inst = DirectCast(pdfCtrl.Inst.GetExtension("PXC"), PDFXEdit.IPXC_Inst)

        Dim StampMgr = xcInst.StampsManager

        Dim MyNewCollection = StampMgr.CreateEmptyCollection("Signatures")

        Dim name As PDFXEdit.IAFS_Name = fsInst.DefaultFileSys.StringToName(gAppDataPath & "\Tracker Software\PDFXEditor\3.0\Stamps\Signatures.pdf")
        Dim file As PDFXEdit.IAFS_File = fsInst.DefaultFileSys.OpenFile(Name, CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read) Or CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead))

        Dim Stamp1 = MyNewCollection.AddStamp(file, "Red", 0)
        Dim Stamp2 = MyNewCollection.AddStamp(file, "Blue", 1)
        Dim Stamp3 = MyNewCollection.AddStamp(file, "Green", 2)

    End Sub
For some reason I get a "NotImplementedException" on the last 3 lines. I figured it should simply return a StampInfo object?

Thanks,
Doc.It Development
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Handling and manipulating stamps

Post by Sasha - PDF-XChange »

Hello docu-track99,

The thing is that the AddStamp method is had not been implemented yet thus the error occurs when you're launching it. We will try to implement it for one of the nearest releases or provide some workaround if possible.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Handling and manipulating stamps

Post by Sasha - PDF-XChange »

Hello docu-track99,

The AddStamp(s) methods should be implemented now so you can check them out.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ