How to change colorStroke for Digital Signature

23 views
Skip to first unread message

Sipho Koza

unread,
Jun 2, 2016, 6:08:03 PM6/2/16
to PDFTron PDFNet SDK
Hi,

I'm creating a digital signature and I want to change the color of my signature on the pdf, How do I do that in iOS (Objective C)?

I managed to change the thicknessStroke of the signature on the pdf from Thin to Normal to Thick.

I tried the below code to change the color of my signature on the pdf but couldn't succeed.

# "DigitalSignatureTool.h"  Class

-(void)saveAppearanceWithPath:(NSMutableArray*)points fromCanvasSize:(CGSize)canvasSize
{
       PTElement *element = [apBuilder PathEnd];
        [element SetPathStroke:YES];

       [[element GetGState] SetLineWidth:1.0f];
       [[element GetGState] SetLineCap:e_ptround_cap];
        [[element GetGState] SetLineJoin:e_ptround_join];

//This is where I tried to change the color
       [[element GetGState] SetStrokeColorWithColorPt:[[PTColorPt alloc] initWithX:1.0f
                                                                                  y:0.0f
                                                                                  z:0.0f
                                                                                  w:1.0f]];

}
 

Ryan

unread,
Jun 3, 2016, 7:08:44 PM6/3/16
to PDFTron PDFNet SDK
Try calling SetStrokeColorSpace before SetStrokeColorWithPT

For example
[[element GetGState] SetStrokeColorSpace: [PTColorSpace CreateDeviceRGB]];

Sipho Koza

unread,
Jun 8, 2016, 1:52:25 PM6/8/16
to PDFTron PDFNet SDK
This worked like a charm. Thank you.
Reply all
Reply to author
Forward
0 new messages