iOS programmatic signature addition, change of signature thickness



  1. The version 6.2.1 had supported signature function. Could you tell me how to save and fill the signature field data in the pdf form by programming. It just like text and checkbox field in pdf form.

  2. On the version 6.2.1 had release open source project “PDFViewCtrlTools”. we want to support two difference width of line in difference signature field, could you have idea to implement it?
    You can achieve both of these items by customizing the tools.

For 1, in file DigitalSignatureTool.m, you can call the method -(void)saveAppearanceWithPath:(NSMutableArray*)points withBoundingRect:(CGRect)boundingRect asDefault:(BOOL)asDefault directly (with appropriate parameters).

You will have to make sure that the tool’s member variable m_moving_annotation has been set to the form field that you are adding the signature to. In the interactive mode this is done inDigitalSignatureTool.m’s method - (BOOL)selectDigSig:(UIGestureRecognizer*)gestureRecognizer but you will have to find the signature using ElementReader, or in a manner similar to how you are currently locating checkbox fields.

For 2, you can change the line thickness in the file TRNStampManager.m, method -(PTPDFDoc*)CreateSignature:(NSMutableArray*)points withColor:(UIColor*)strokeColor withinRect:(CGRect)rect makeDefault:(BOOL)makeDefault

There is a local variable strokeWidth that can be changed to adjust the line thickness.