Sorry if this is the wrong group, I couldn't a find a PDFKit specific group.
I have an app that downloads a PDF consent form that the user can ask a client to sign and have it sent back to a server.
I can download and display the PDF but I'm struggling with the signature bit. The code below will draw a box with a cross in it on the simulator but isn't allowing the mouse to draw a signature.
The documentation on this seems a bit light.
Has anybody got the signature to work?
My PDFView has some code:
PDFView *view;
...
view.autoScales = NO ;
view.displayDirection = kPDFDisplayDirectionVertical;
view.displayMode = kPDFDisplaySinglePageContinuous;
view.displaysRTL = YES ;
[view setDisplaysPageBreaks:YES];
[view setDisplayBox:kPDFDisplayBoxTrimBox];
view.document = _dataLink.pdf;
// This locates the one occuarnce that I need to find.
NSArray *searchResults = [view.document findString:@"Signauture:" withOptions:NSLiteralSearch];
if (searchResults.count > 0)
{
// If multiple signature blocks found use the last one.
PDFSelection *i = [searchResults objectAtIndex:searchResults.count - 1];
PDFPage *page = [i.pages objectAtIndex:0];
page.displaysAnnotations = YES;
CGRect r = [i boundsForPage:page]; // CGRect of the search string.
r.size.width = 360; // make it bigger so that the user has room to sign.
r.size.height = 65;
PDFAnnotation *ann = [[PDFAnnotation alloc] initWithBounds:r
forType:PDFAnnotationSubtypeWidget
withProperties:nil];
PDFBorder *border = [[PDFBorder alloc] init];
border.lineWidth = 2.0;
ann.border = border;
ann.color = [UIColor blueColor];
ann.backgroundColor = [UIColor darkGrayColor];
ann.widgetFieldType = PDFAnnotationWidgetSubtypeSignature;
ann.fieldName = @"Signature";
ann.caption = @"Signature:";
ann.shouldDisplay = YES;
ann.shouldPrint = YES;
[page addAnnotation:ann];
// Just in case any of these make a differemce - no they don't
[view setNeedsDisplay];
[view annotationsChangedOnPage:page];
}