Examples of PdfFormField


Examples of com.lowagie.text.pdf.PdfFormField

    }

    @Override
    public void cellLayout(PdfPCell cell, Rectangle rectangle, PdfContentByte[] canvases) {
        PdfWriter writer = canvases[0].getPdfWriter();
        PdfFormField radiogroup = PdfFormField.createRadioButton(writer, true);
        radiogroup.setFieldName(UUID.randomUUID().toString());
        if(locked) {
            radiogroup.setFieldFlags(BaseField.READ_ONLY);
        }
        RadioCheckField radio;
        for (int i = 0; i < values.length; i++) {
            try {
                Rectangle rect = getBoxRectangle(rectangle, i);
                radio = new RadioCheckField(writer, rect, null, UUID.randomUUID().toString());
                radio.setBorderColor(GrayColor.GRAYBLACK);
                radio.setBackgroundColor(GrayColor.GRAYWHITE);
                radio.setCheckType(RadioCheckField.TYPE_CIRCLE);
                if(value != null && values[i].equals(value)) {
                    radio.setChecked(true);
                }
                PdfFormField field = radio.getRadioField();
                radiogroup.addKid(field);
                addBoxDescription(rectangle, i, values, canvases);
            } catch (IOException ex) {
                Logger.getLogger(ITextRadio.class.getName()).log(Level.SEVERE, null, ex);
            } catch (DocumentException ex) {
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

                            break;
                        }
                    }
                }
                checkbox.setChecked(checked);
                PdfFormField field = checkbox.getCheckField();
                field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", onOff[0]);
                field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Yes", onOff[1]);
                if (locked) {
                    field.setFieldFlags(BaseField.READ_ONLY);
                }
                writer.addAnnotation(field);
                ITextRadio.addBoxDescription(rectangle, i, values, canvases);
            } catch (IOException ex) {
                Logger.getLogger(ITextCheckbox.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

        text.setBorderStyle(PdfBorderDictionary.STYLE_INSET);
        text.setText(value);
        text.setFontSize(FONTSIZE);
        text.setAlignment(Element.ALIGN_LEFT);
        try {
            PdfFormField field = text.getTextField();
            if(locked) {
                field.setFieldFlags(BaseField.READ_ONLY);
            }
            writer.addAnnotation(field);
        } catch (IOException ioe) {
            throw new ExceptionConverter(ioe);
        } catch (DocumentException de) {
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

                text.setChoiceSelection(i);
                break;
            }
        }
        try {
            PdfFormField comboField = text.getComboField();
            if(locked) {
                comboField.setFieldFlags(BaseField.READ_ONLY);
            }
            writer.addAnnotation(comboField);
        } catch (IOException ex) {
            Logger.getLogger(ITextSelect.class.getName()).log(Level.SEVERE, null, ex);
        } catch (DocumentException ex) {
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

                }
            }
        }
        text.setChoiceSelections(choiceSelections);
        try {
            PdfFormField listField = text.getListField();
            if(locked) {
                listField.setFieldFlags(BaseField.READ_ONLY);
            }
            writer.addAnnotation(listField);
        } catch (IOException ex) {
            Logger.getLogger(ITextListbox.class.getName()).log(Level.SEVERE, null, ex);
        } catch (DocumentException ex) {
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            String text = "Some start text";
            float fontSize = 12;
            Color textColor = new GrayColor(0f);
            PdfFormField field = PdfFormField.createTextField(writer, false, false, 0);
            field.setWidget(new LwgRectangle(171, 750, 342, 769), PdfAnnotation.HIGHLIGHT_INVERT);
            field.setFlags(PdfAnnotation.FLAGS_PRINT);
            field.setFieldName("ATextField");
            field.setValueAsString(text);
            field.setDefaultValueAsString(text);
            field.setBorderStyle(new PdfBorderDictionary(2, PdfBorderDictionary.STYLE_SOLID));
            field.setPage();
            PdfAppearance tp = cb.createAppearance(171, 19);
            PdfAppearance da = (PdfAppearance)tp.getDuplicate();
            da.setFontAndSize(helv, fontSize);
            da.setColorFill(textColor);
            field.setDefaultAppearanceString(da);
            tp.beginVariableText();
            tp.saveState();
            tp.rectangle(2, 2, 167, 15);
            tp.clip();
            tp.newPath();
            tp.beginText();
            tp.setFontAndSize(helv, fontSize);
            tp.setColorFill(textColor);
            tp.setTextMatrix(4, 5);
            tp.showText(text);
            tp.endText();
            tp.restoreState();
            tp.endVariableText();
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
            writer.addAnnotation(field);
           
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

            document.open();
           
            // step 4:
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfFormField radio = PdfFormField.createRadioButton(writer, true);
            PdfAppearance tpOff = cb.createAppearance(20, 20);
            PdfAppearance tpOn = cb.createAppearance(20, 20);
           
            tpOff.circle(10, 10, 9);
            tpOff.stroke();

            tpOn.circle(10, 10, 9);
            tpOn.stroke();
            tpOn.circle(10, 10, 3);
            tpOn.fillStroke();

            radio.setFieldName("CreditCard");
            radio.setValueAsName("MasterCard");

            PdfFormField radio1 = PdfFormField.createEmpty(writer);
            radio1.setWidget(new LwgRectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
            radio1.setAppearanceState("MasterCard");
            radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "MasterCard", tpOn);
            radio.addKid(radio1);
           
            PdfFormField radio2 = PdfFormField.createEmpty(writer);
            radio2.setWidget(new LwgRectangle(100, 660, 120, 680), PdfAnnotation.HIGHLIGHT_INVERT);
            radio2.setAppearanceState("Off");
            radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Visa", tpOn);
            radio.addKid(radio2);
           
            PdfFormField radio3 = PdfFormField.createEmpty(writer);
            radio3.setWidget(new LwgRectangle(100, 620, 120, 640), PdfAnnotation.HIGHLIGHT_INVERT);
            radio3.setAppearanceState("Off");
            radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "American", tpOn);
            radio.addKid(radio3);
           
            writer.addAnnotation(radio);
           
        }
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

            innertable.add(new Paragraph("name:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "name");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField name = text.getTextField();
            cell.setCellEvent(new StudentCardForm(name));
            innertable.add(cell);
            innertable.add(new Paragraph("date of birth:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "birthday");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField birthdate = text.getTextField();
            cell.setCellEvent(new StudentCardForm(birthdate));
            innertable.add(cell);
            innertable.add(new Paragraph("Study Program:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "studyprogram");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField studyprogram = text.getTextField();
            studyprogram.setFieldName("studyprogram");
            cell.setCellEvent(new StudentCardForm(studyprogram));
            innertable.add(cell);
            innertable.add(new Paragraph("option:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "option");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField option = text.getTextField();
            option.setFieldName("option");
            cell.setCellEvent(new StudentCardForm(option));
            innertable.add(cell);
            outertable.add(innertable);
            cell = new LwgPdfPCell();
      cell.setBackgroundColor(new Color(0xFF, 0xDE, 0xAD));
            PdfFormField picture = PdfFormField.createPushButton(writer);
            picture.setFieldName("picture");
            cell.setCellEvent(new StudentCardForm(picture));
            outertable.add(cell);
            cell = new LwgPdfPCell();
      cell.setBackgroundColor(Color.WHITE);
            PdfFormField barcode = PdfFormField.createPushButton(writer);
            barcode.setFieldName("barcode");
            cell.setCellEvent(new StudentCardForm(barcode));
            outertable.add(cell);
            outertable.writeSelectedRows(0, -1, 20, 100, writer.getDirectContent());
            writer.addAnnotation(name);
            writer.addAnnotation(birthdate);
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

            tf.setBorderStyle(PdfBorderDictionary.STYLE_BEVELED);
            tf.setText("It was the best of times, it was the worst of times, it was the age of wisdom...");
            tf.setAlignment(LwgElement.ALIGN_CENTER);
            tf.setOptions(TextField.MULTILINE | TextField.REQUIRED);
            tf.setRotation(90);
            PdfFormField field = tf.getTextField();
            writer.addAnnotation(field);
           
            tf = new TextField(writer, new LwgRectangle(250, 300, 250 + 100, 300 + 20), "Combos");
            tf.setBackgroundColor(Color.RED);
            tf.setBorderColor(Color.BLUE);
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

            document.open();
           
            // step 4:
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfFormField field = PdfFormField.createCheckBox(writer);
            PdfAppearance tpOff = cb.createAppearance(20, 20);
            PdfAppearance tpOn = cb.createAppearance(20, 20);
            tpOff.rectangle(1, 1, 18, 18);
            tpOff.stroke();
           
            tpOn.setRGBColorFill(255, 128, 128);
            tpOn.rectangle(1, 1, 18, 18);
            tpOn.fillStroke();
            tpOn.moveTo(1, 1);
            tpOn.lineTo(19, 19);
            tpOn.moveTo(1, 19);
            tpOn.lineTo(19, 1);
            tpOn.stroke();
           
            field.setWidget(new LwgRectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
            field.setFieldName("Urgent");
            field.setValueAsName("Off");
            field.setAppearanceState("Off");
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "On", tpOn);
            writer.addAnnotation(field);
           
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.