I'm following the Objective-C signature example ( http://www.pdftron.com/pdfnet/samplecode/DigitalSignaturesTest.m ) and I have come across a PDF document in landscape mode. When I sign the document the signatures image is rotated 90 degrees. All other text boxes on the page is fine. How can add the image to the digital signature field in the correct orientation. When I applying to a rotation transformation to the image it just disappears.
My latest attempt where the signature is missing only because of the line where I added the 90 degree rotation.
double w = [sigImg GetImageWidth], h = [sigImg GetImageHeight];
Matrix2D *matrix = [[[Matrix2D alloc] initWithA:w
b:0
c:0
d:h
h:0
v:0] autorelease];
Matrix2D *rotation = [Matrix2D RotationMatrix:90 * M_PI / 180.];
[matrix Concat:rotation.getM_a b:rotation.getM_b c:rotation.getM_c d:rotation.getM_d h:rotation.getM_h v:rotation.getM_v];
Element* apElement = [apBuilder CreateImageWithMatrix:sigImg mtx:matrix];
//Element* apElement = [apBuilder CreateImageWithCornerAndScale: sigImg x: 0 y: 0 hscale: w vscale: h];
[apWriter WritePlacedElement: apElement];
Obj* apObj = [apWriter End];
[apObj PutRect: @"BBox" x1: 0 y1: 0 x2: w y2: h];
[apObj PutName: @"Subtype" name: @"Form"];
[apObj PutName: @"Type" name: @"XObject"];
[apWriter WriterBeginWithSDFDoc: [doc GetSDFDoc] compress: YES];
apElement = [apBuilder CreateFormWithObj: apObj];
[apWriter WritePlacedElement: apElement];
apObj = [apWriter End];
[apObj PutRect: @"BBox" x1: 0 y1: 0 x2: w y2: h];
[apObj PutName: @"Subtype" name: @"Form"];
[apObj PutName: @"Type" name: @"XObject"];
[widgetAnnot SetAppearance: apObj annot_state: e_normal app_state: nil];
[widgetAnnot RefreshAppearance];
Obj* widgetObj = [widgetAnnot GetSDFObj];
[widgetObj PutNumber: @"F" value: 132];
[widgetObj PutName: @"Type" name: @"Annot"];