Re: [PDFNet] Custom Sticky Note image

267 views
Skip to first unread message

James Borthwick

unread,
Mar 19, 2013, 1:58:35 PM3/19/13
to PDFTron PDFNet SDK on behalf of mikesowerbutts@yahoo.co.uk
Hello Mike,

I believe there is some confusion over the purpose of the SetTextIconName selector. The name is not a path to an image file, but rather is used as a field to keep track of which icon is being shown. If the name is one of the pre-defined names that are documented as part of the PDF specification (listed below), then the corresponding default icon will be used by PDFNet.

Comment
Key
Help
NewParagraph
Paragraph
Insert
Note
Unknown

If you wish to use a custom icon, you will need to set the annotation's appearance stream, which could in your case be an image. If the annotation has a custom appearance stream, the name field is ignored. For an example of how to set an annotation's appearance stream, please see the following forum post:


The ElementBuilderTest sample project shows how to include an image using ElementBuilder:


Note that the iOS sample project only uses the image temporarily while the user is "creating" the annotation, for example while dragging their finger around the page before releasing it. The image is not added to the PDF because the icon is one of the standard PDF icons.

Best Regards,

James

On Tue, Mar 19, 2013 at 9:28 AM, [email address] via PDFTron PDFNet SDK <pdfnet-sdk+noreply-APn2wQdQvt14w...@googlegroups.com> wrote:
Hi,

I am looking to change the default icon I get when adding sticky notes via code to the PDF. Currently I am using this function:

-(void)createStickyNoteAnnotation:(PDFPoint *)point{

    Page* page = [[pdfViewControl GetDoc] GetPage:1];

    PDFRect *r = [[PDFRect alloc] initWithX1: point.getX y1:point.getY x2:point.getX + 70 y2:point.getY + 70];

    Text *t = [Text Create:[[pdfViewControl GetDoc] GetSDFDoc] pos:r];

    //[t SetTextIconName:[Utils getFilePathInBundle:@"StickyNoteIcon.png"]];

    Markup *mu = [[Markup alloc] initWithAnn:t];

    [mu SetContents:annotationInformation.value];

    Popup *p = [mu GetPopup];

    if(p == nil || !p.IsValid){

        p = [Popup Create:[[pdfViewControl GetDoc] GetSDFDoc] pos:r];

        [mu SetPopup:p];

    }

    [p SetContents:annotationInformation.value];

    [page AnnotPushBack:t];

    [self finishedAddingAnnotation];

}


The commented out line [t SetTextIconName:...]; is where I am trying to set the image, but this is throwing an error.


I see the sample project uses a custom image and I would like to do the same, but as its a .a file, I cant see how...


Thanks,


Mike

--
You received this message because you are subscribed to the "PDFTron PDFNet SDK" group (http://www.pdftron.com/pdfnet/forum.html).
---
You received this message because you are subscribed to the Google Groups "PDFTron PDFNet SDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-sdk+...@googlegroups.com.
To post to this group, send email to pdfne...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages