Package org.pdfclown.documents.interaction.forms

Examples of org.pdfclown.documents.interaction.forms.Form


    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();

    // 2. Get the acroform!
    Form form = document.getForm();
    if(form == null)
    {System.out.println("\nNo acroform available (AcroForm dictionary not found).");}
    else
    {
      System.out.println("\nIterating through the fields collection...\n");
 
      // 3. Showing the acroform fields...
      HashMap<String,Integer> objCounters = new HashMap<String,Integer>();
      for(Field field : form.getFields().values())
      {
        System.out.println("* Field '" + field.getFullName() + "' (" + field.getBaseObject() + ")");
 
        String typeName = field.getClass().getSimpleName();
        System.out.println("    Type: " + typeName);
        System.out.println("    Value: " + field.getValue());
        System.out.println("    Data: " + field.getBaseDataObject().toString());

        int widgetIndex = 0;
        for(Widget widget : field.getWidgets())
        {
          System.out.println("    Widget " + (++widgetIndex) + ":");
          Page widgetPage = widget.getPage();
          System.out.println("      Page: " + (widgetPage == null ? "undefined" : (widgetPage.getIndex() + 1) + " (" + widgetPage.getBaseObject() + ")"));
   
          Rectangle2D widgetBox = widget.getBox();
          System.out.println("      Coordinates: {x:" + Math.round(widgetBox.getX()) + "; y:" + Math.round(widgetBox.getY()) + "; width:" + Math.round(widgetBox.getWidth()) + "; height:" + Math.round(widgetBox.getHeight()) + "}");
        }

        objCounters.put(typeName, (objCounters.containsKey(typeName) ? objCounters.get(typeName) : 0) + 1);
      }
 
      int fieldCount = form.getFields().size();
      if(fieldCount == 0)
      {System.out.println("No field available.");}
      else
      {
        System.out.println("\nFields partial counts (grouped by type):");
View Full Code Here


        4.2. apply the appearance style to your field;
        4.3. insert your field into the fields collection.
    */

    // 1. Define the form fields collection!
    Form form = new Form(document);
    document.setForm(form);
    Fields fields = form.getFields();

    // 2. Define the page where to place the fields!
    Page page = new Page(document);
    document.getPages().add(page);

View Full Code Here

  {
    PdfDirectObject formObject = getBaseDataObject().get(PdfName.AcroForm);
    if(formObject == null)
      return null;

    return new Form(formObject, getContainer());
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.documents.interaction.forms.Form

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.