Search in sources :

Example 1 with TextField

use of com.lowagie.text.pdf.TextField in project dhis2-core by dhis2.

the class DefaultPdfDataEntryFormService method addCell_WithDropDownListField.

private void addCell_WithDropDownListField(PdfPTable table, Rectangle rect, PdfWriter writer, PdfPCell cell, String strfldName, String[] optionList, String[] valueList) throws IOException, DocumentException {
    TextField textList = new TextField(writer, rect, strfldName);
    textList.setChoices(optionList);
    textList.setChoiceExports(valueList);
    textList.setBorderWidth(1);
    textList.setBorderColor(Color.BLACK);
    textList.setBorderStyle(PdfBorderDictionary.STYLE_SOLID);
    textList.setBackgroundColor(COLOR_BACKGROUDTEXTBOX);
    PdfFormField dropDown = textList.getComboField();
    cell.setCellEvent(new PdfFieldCell(dropDown, rect.getWidth(), rect.getHeight(), writer));
    table.addCell(cell);
}
Also used : PdfFormField(com.lowagie.text.pdf.PdfFormField) TextField(com.lowagie.text.pdf.TextField)

Example 2 with TextField

use of com.lowagie.text.pdf.TextField in project dhis2-core by dhis2.

the class DefaultPdfDataEntryFormService method addCell_WithTextField.

private void addCell_WithTextField(PdfPTable table, Rectangle rect, PdfWriter writer, PdfPCell cell, String strfldName, int fieldCellType, String value) throws IOException, DocumentException {
    TextField nameField = new TextField(writer, rect, strfldName);
    nameField.setBorderWidth(1);
    nameField.setBorderColor(Color.BLACK);
    nameField.setBorderStyle(PdfBorderDictionary.STYLE_SOLID);
    nameField.setBackgroundColor(COLOR_BACKGROUDTEXTBOX);
    nameField.setText(value);
    nameField.setAlignment(Element.ALIGN_RIGHT);
    nameField.setFont(pdfFormFontSettings.getFont(PdfFormFontSettings.FONTTYPE_BODY).getBaseFont());
    cell.setCellEvent(new PdfFieldCell(nameField.getTextField(), rect.getWidth(), rect.getHeight(), fieldCellType, writer));
    table.addCell(cell);
}
Also used : TextField(com.lowagie.text.pdf.TextField)

Aggregations

TextField (com.lowagie.text.pdf.TextField)2 PdfFormField (com.lowagie.text.pdf.PdfFormField)1