Example usage for com.lowagie.text.pdf PdfAction SUBMIT_PDF

List of usage examples for com.lowagie.text.pdf PdfAction SUBMIT_PDF

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfAction SUBMIT_PDF.

Prototype

int SUBMIT_PDF

To view the source code for com.lowagie.text.pdf PdfAction SUBMIT_PDF.

Click Source Link

Document

a possible submitvalue

Usage

From source file:org.obiba.onyx.marble.core.service.FdfProducer.java

License:Open Source License

@SuppressWarnings("unchecked")
protected void setFields(AcroFields acroFields, CustomFdfWriter fdf) throws IOException, DocumentException {
    Map<String, Item> fields = acroFields.getFields();
    log.debug("PDF template has {} fields", fields.size());
    for (String fieldName : fields.keySet()) {
        log.debug("Processing PDF template field {}", fieldName);
        String shortFieldName = getFieldShortName(fieldName);

        log.debug("Field name converted to {}", shortFieldName);

        Object fieldValue = findValue(shortFieldName);
        if (fieldValue != null) {
            if (isFieldPushButton(acroFields.getFieldType(fieldName))) {
                log.info("Setting submit button {} with URL {}", fieldName, fieldValue);
                fdf.setFieldAsAction(fieldName,
                        PdfAction.createSubmitForm(fieldValue.toString(), null, PdfAction.SUBMIT_PDF));
            } else {
                log.info("Setting field {} with value of type {}",
                        new Object[] { fieldName, fieldValue.getClass().getName() });
                fdf.setFieldAsString(fieldName, fieldValue.toString());
            }/*from  w ww . j ava 2s . c  o  m*/
        } else {
            log.debug("No value found for field (or value is null). No replacement made.");
        }
    }
    log.debug("PDF processing complete");
}