Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfFormField


        acroForm.addCalculationOrder(formField);
    }
   
    public void addAnnotation(PdfAnnotation annot) {
        if (annot.isForm()) {
            PdfFormField field = (PdfFormField)annot;
            if (field.getParent() == null)
                addFormFieldRaw(field);
        }
        else
            annotations.add(annot);
    }
View Full Code Here


                if (!dic.isUsed()) {
                    HashMap templates = dic.getTemplates();
                    if (templates != null)
                        acroForm.addFieldTemplates(templates);
                }
                PdfFormField field = (PdfFormField)dic;
                if (field.getParent() == null)
                    acroForm.addDocumentField(field.getIndirectReference());
            }
            if (dic.isAnnotation()) {
                array.add(dic.getIndirectReference());
                if (!dic.isUsed()) {
                    PdfRectangle rect = (PdfRectangle)dic.get(PdfName.RECT);
View Full Code Here

            TextField ff = new TextField(writer, new LwgRectangle(200, 600, 300, 620), "field1");
            ff.setBorderColor(Color.blue);
            ff.setBorderStyle(PdfBorderDictionary.STYLE_SOLID);
            ff.setBorderWidth(TextField.BORDER_WIDTH_THIN);
            ff.setText("I'm a form field");
            PdfFormField form = ff.getTextField();
            form.setLayer(l4);
            writer.addAnnotation(form);
            LwgImage img = LwgImage.getInstance("pngnow.png");
            img.setLayer(l4);
            img.setAbsolutePosition(200, 550);
            cb.addImage(img);
View Full Code Here

        acroForm.addCalculationOrder(formField);
    }
   
    public void addAnnotation(PdfAnnotation annot) {
        if (annot.isForm()) {
            PdfFormField field = (PdfFormField)annot;
            if (field.getParent() == null)
                addFormFieldRaw(field);
        }
        else
            annotations.add(annot);
    }
View Full Code Here

                if (!dic.isUsed()) {
                    HashMap templates = dic.getTemplates();
                    if (templates != null)
                        acroForm.addFieldTemplates(templates);
                }
                PdfFormField field = (PdfFormField)dic;
                if (field.getParent() == null)
                    acroForm.addDocumentField(field.getIndirectReference());
            }
            if (dic.isAnnotation()) {
                array.add(dic.getIndirectReference());
                if (!dic.isUsed()) {
                    PdfRectangle rect = (PdfRectangle)dic.get(PdfName.RECT);
View Full Code Here

   * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.LwgRectangle, java.lang.String)
   */
  public void onGenericTag(PdfWriter writer, LwgDocument document,
      LwgRectangle rect, String text) {
    rect.setBottom(rect.getBottom() - 3);
    PdfFormField field = (PdfFormField) genericChunkFields.get(text);
    if (field == null) {
      TextField tf = new TextField(writer, new LwgRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)), text);
      tf.setFontSize(14);
      try {
        field = tf.getTextField();
      } catch (Exception e) {
        throw new ExceptionConverter(e);
      }
    }
    else {
      field.put(PdfName.RECT,  new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
    }
    if (parent == null)
      writer.addAnnotation(field);
    else
      parent.addKid(field);
View Full Code Here

    }

    @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

                            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

        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

                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

TOP

Related Classes of com.lowagie.text.pdf.PdfFormField

Copyright © 2018 www.massapicom. 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.