Can I extend PTAnnot to include more fields.

Visto 78 veces
Saltar al primer mensaje no leído

Claire Poza

no leída,
27 sept 2017, 18:10:5227/9/17
a PDFTron PDFNet SDK
I need to store a boolean, string userid, timestamp on each of the annotations that are saved.

I see the object type PTAnnot and where it is saved from the tools, but what would be the best way to extend this?

@interface PTAnnot : NSObject

{

void *swigCPtr;

BOOL swigCMemOwn;

}

- (void*)getCptr;

- (instancetype)initWithCptr: (void*) cptr;

- (void)setSwigCMemOwn: (BOOL) own;

- (void)dealloc;

+ (PTAnnot*)Create: (PTSDFDoc*)doc type:  (PTAnnotType)type pos:  (PTPDFRect*)pos;

- (BOOL)IsValid;

- (PTObj*)GetSDFObj;

- (PTAnnotType)GetType;

- (PTPDFRect*)GetRect;

- (PTPDFRect*)GetVisibleContentBox;

- (BOOL)IsMarkup;

- (void)SetRect: (PTPDFRect*)pos;

- (PTPage*)GetPage;

- (void)SetPage: (PTPage*)page;

- (PTObj*)GetUniqueID;

- (void)SetUniqueID: (NSString *)id id_buf_sz:  (int)id_buf_sz;

- (PTDate*)GetDate;

- (void)SetDate: (PTDate*)date;

- (BOOL)GetFlag: (PTAnnotFlag)flag;

- (void)SetFlag: (PTAnnotFlag)flag value:  (BOOL)value;

- (PTObj*)GetTriggerAction: (PTAnnotActionTriggerEvent)trigger;

- (PTBorderStyle*)GetBorderStyle;

- (void)SetBorderStyle: (PTBorderStyle*)bs oldStyleOnly:  (BOOL)oldStyleOnly;

- (PTObj*)GetAppearance: (PTAnnotationState)annot_state app_state:  (NSString *)app_state;

- (void)SetAppearance: (PTObj*)app_stream annot_state:  (PTAnnotationState)annot_state app_state:  (NSString *)app_state;

- (void)RemoveAppearance: (PTAnnotationState)annot_state app_state:  (NSString *)app_state;

- (void)Flatten: (PTPage*)page;

- (NSString *)GetActiveAppearanceState;

- (void)SetActiveAppearanceState: (NSString *)astate;

- (PTColorPt*)GetColorAsRGB;

- (PTColorPt*)GetColorAsCMYK;

- (PTColorPt*)GetColorAsGray;

- (int)GetColorCompNum;

- (void)SetColor: (PTColorPt*)col numcomp:  (int)numcomp;

- (int)GetStructParent;

- (void)SetStructParent: (int)parkeyval;

- (PTObj*)GetOptionalContent;

- (void)SetOptionalContent: (PTObj*)content;

- (void)SetContents: (NSString*)contents;

- (NSString*)GetContents;

- (int)GetRotation;

- (void)SetRotation: (int)angle;

- (void)RefreshAppearance;

- (void)Resize: (PTPDFRect*)newrect;

+ (PTAnnot*)CreateInternal: (unsigned long long)impl;

- (unsigned long long)GetHandleInternal;

- (instancetype)initWithD: (PTObj*)d;

@end

Ryan

no leída,
29 sept 2017, 12:36:4729/9/17
a PDFTron PDFNet SDK
Yes, you can store custom data on an annotation.

First, though, you can store most of this using the built in API. Usually the annots that you want to handle like this are Markup annotations, which have some additional properties.

string userid
 This entry is also used to identify the user who added the annotation. 

timestamp on each of the annotations that are saved.
Sets an annotation’s last modified date.

The advantage of using the existing API is that these are fully supported by PDFNet and other conforming PDF software. 

Otherwise, to go ahead with custom entries, this forum post should help you.

But it would be great to know more about why these three options are important for you? Why is the boolean important for you?


Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos