Examples of PdfFormField


Examples of com.lowagie.text.pdf.PdfFormField

  public void cellLayout(LwgPdfPCell cell, LwgRectangle position,
      PdfContentByte[] canvases) {
    TextField tf = new TextField(writer, position, fieldname);
    tf.setFontSize(12);
    try {
      PdfFormField field = tf.getTextField();
      writer.addAnnotation(field);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (DocumentException e) {
      e.printStackTrace();
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

           
            // step 4:
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            String options[] = {"Red", "Green", "Blue"};
            PdfFormField field = PdfFormField.createCombo(writer, true, options, 0);
            field.setWidget(new LwgRectangle(100, 700, 180, 720), PdfAnnotation.HIGHLIGHT_INVERT);
            field.setFieldName("ACombo");
            field.setValueAsString("Red");
            writer.addAnnotation(field);
           
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

           
            // step 3: we open the document
            document.open();
           
            // step 4:
            PdfFormField pushbutton = PdfFormField.createPushButton(writer);
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfAppearance normal = cb.createAppearance(100, 50);
            normal.setColorFill(Color.GRAY);
            normal.rectangle(5, 5, 90, 40);
            normal.fill();
            PdfAppearance rollover = cb.createAppearance(100, 50);
            rollover.setColorFill(Color.RED);
            rollover.rectangle(5, 5, 90, 40);
            rollover.fill();
            PdfAppearance down = cb.createAppearance(100, 50);
            down.setColorFill(Color.BLUE);
            down.rectangle(5, 5, 90, 40);
            down.fill();           
            pushbutton.setFieldName("PushMe");
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, normal);
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_ROLLOVER, rollover);
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_DOWN, down);
            pushbutton.setWidget(new LwgRectangle(100, 700, 200, 750), PdfAnnotation.HIGHLIGHT_PUSH);
            writer.addAnnotation(pushbutton);
           
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
View Full Code Here

Examples of com.lowagie.text.pdf.PdfFormField

   * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
   */
  public void onGenericTag(PdfWriter writer, Document document,
      Rectangle rect, String text) {
    rect.setBottom(rect.getBottom() - 3);
    PdfFormField field = (PdfFormField) genericChunkFields.get(text);
    if (field == null) {
      TextField tf = new TextField(writer, new Rectangle(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

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

Examples of com.lowagie.text.pdf.PdfFormField

                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

Examples of com.lowagie.text.pdf.PdfFormField

   * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
   */
  public void onGenericTag(PdfWriter writer, Document document,
      Rectangle rect, String text) {
    rect.setBottom(rect.getBottom() - 3);
    PdfFormField field = (PdfFormField) genericChunkFields.get(text);
    if (field == null) {
      TextField tf = new TextField(writer, new Rectangle(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

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

Examples of com.lowagie.text.pdf.PdfFormField

                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

Examples of com.lowagie.text.pdf.PdfFormField

        PdfWriter writer = outputDevice.getWriter();
       
        String[][] options = getPDFOptions();
        int selectedIndex = getSelectedIndex();
       
        PdfFormField field;
       
        /*
         * Comment out for now.  We need to draw an appropriate appearance for
         * this to work correctly.
         */
        /*
        if (isMultiple(box.getElement())) {
            field = PdfFormField.createList(writer, options, selectedIndex); 
        } else {
            field = PdfFormField.createCombo(writer, false, options, selectedIndex);   
        }
        */
       
        field = PdfFormField.createCombo(writer, false, options, selectedIndex);   
       
        field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT);
        field.setFieldName(getFieldName(outputDevice, box.getElement()));
        if (options.length > 0) {
            field.setValueAsString(options[selectedIndex][0]);
        }
       
        createAppearance(c, outputDevice, box, field);

        if (isReadOnly(box.getElement())) {
            field.setFieldFlags(PdfFormField.FF_READ_ONLY);
        }      
       
        /*
        if (isMultiple(box.getElement())) {
            field.setFieldFlags(PdfFormField.FF_MULTISELECT);
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.