List of usage examples for com.itextpdf.text.pdf PdfFormField createSignature
public static PdfFormField createSignature(PdfWriter writer)
From source file:gov.nih.nci.firebird.service.registration.AbstractPdfWriterGenerator.java
License:Open Source License
private void addSignatureField() throws DocumentException { PdfFormField field = PdfFormField.createSignature(writer); Rectangle signatureFieldRectangle = new Rectangle(SIGNATURE_FIELD_LOWER_LEFT_X, SIGNATURE_FIELD_LOWER_LEFT_Y, SIGNATURE_FIELD_UPPER_RIGHT_X, SIGNATURE_FIELD_UPPER_RIGHT_Y); field.setWidget(signatureFieldRectangle, PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName("signature"); field.setFlags(PdfAnnotation.FLAGS_PRINT); field.setPage();//from w ww.j a va 2s. c o m field.setMKBorderColor(BaseColor.BLACK); field.setMKBackgroundColor(BaseColor.WHITE); PdfAppearance appearance = PdfAppearance.createAppearance(writer, SIGNATURE_FIELD_WIDTH, SIGNATURE_FIELD_HEIGHT); appearance.rectangle(SIGNATURE_FIELD_APPEARANCE_X, SIGNATURE_FIELD_APPEARANCE_Y, SIGNATURE_FIELD_APPEARANCE_WIDTH, SIGNATURE_FIELD_APPEARANCE_HEIGHT); appearance.stroke(); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, appearance); writer.addAnnotation(field); }