Signature fields in OpenOffice for tablet handwriting, not digital signature

I want to place a "signature box" in my OpenOffice doc.

I need this for iOS / gPlay "PDF Forms" app for signing PDF documents on touch screens (handwriting / pen).

According to their FAQ, I need a signature on my OO document, but even after hours of research, I am still not now if OO offers such a field. I only find text boxes or digital signatures / certificates.

Do you have a hint of me?

Thanks, Christian

+3


source to share


1 answer


It seems OpenOffice only has a subset of the available fields and the signature field is not available.

Now I will add a text field, naming it something like fldSignature1 and using iText, I will change every field starting with "fldSignature" programmatically with a signature field

UPDATE: here is the code that I am using with success as I said, I created a form where I placed a textbox that acts as a placeholder for the signature field, in my example I named it fldFirma, you can put the substitution code in a loop to change any field that contains a prefix, etc.



here's the code

    String filename = Environment.getExternalStorageDirectory().getPath() + "/testpdf.pdf";
    String filenameOut = Environment.getExternalStorageDirectory().getPath() + "/testpdfCompiled.pdf"; 
    PdfReader reader = new PdfReader(filename);

    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(filenameOut), '\0', true);
    AcroFields fields = stamper.getAcroFields();

    fields.setGenerateAppearances(true);

    String[] fieldsNames = (String[]) fields.getFields().keySet().toArray(new String[fields.getFields().keySet().size()]);
    for (String fieldName : fieldsNames) {
        if (fieldName.equals("fldFirma")) { //change this part with your logic to identify the signature field
            List<FieldPosition> fieldPositions = fields.getFieldPositions(fieldName);
            AcroFields.FieldPosition fieldPosition = fieldPositions.get(0);
            // i remove the "placeholder field"
            fields.removeField(fieldName);

            // and place at its position, the new empty signature field
            stamper.addSignature(
                fieldName,
                fieldPosition.page,
                fieldPosition.position.getLeft(),
                fieldPosition.position.getTop(),
                fieldPosition.position.getRight(),
                fieldPosition.position.getBottom()
                );
        }
    }
    // close pdf stamper
    // stamper.setFormFlattening(true);
    stamper.close();

    stamper.close();
    reader.close();

      

0


source







All Articles