Examples of PdfArray


Examples of org.pdfclown.objects.PdfArray

          PdfDictionary fieldDictionary = (PdfDictionary)fieldReference.getDataObject();
          PdfTextString fieldName = (PdfTextString)fieldDictionary.get(PdfName.T);
          if(fieldName != null && fieldName.getValue().equals(partialName))
          {
            valueFieldReference = fieldReference;
            PdfArray kidFieldObjects = (PdfArray)fieldDictionary.resolve(PdfName.Kids);
            fieldObjectsIterator = (kidFieldObjects == null ? null : kidFieldObjects.iterator());
            break;
          }
        }
        if(valueFieldReference == null)
          break;
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

  {
    Field field = get(key);
    if(field == null)
      return null;

    PdfArray fieldObjects;
    {
      PdfReference fieldParentReference = (PdfReference)field.getBaseDataObject().get(PdfName.Parent);
      if(fieldParentReference == null)
      {fieldObjects = getBaseDataObject();}
      else
      {fieldObjects = (PdfArray)((PdfDictionary)fieldParentReference.getDataObject()).resolve(PdfName.Kids);}
    }
    return (fieldObjects.remove(field.getBaseObject()) ? field : null);
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

    )
  {
    /*
      NOTE: 'D' entry may be undefined.
    */
    PdfArray dashObject = (PdfArray)getBaseDataObject().get(PdfName.D);
    if(dashObject == null)
      return DefaultLineDash;

    float[] dashArray = new float[dashObject.size()];
    for(
      int dashIndex = 0,
        dashLength = dashArray.length;
      dashIndex < dashLength;
      dashIndex++
      )
    {dashArray[dashIndex] = ((PdfNumber<?>)dashObject.get(dashIndex)).getNumberValue();}

    return new LineDash(dashArray);
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

    )
  {
    for(PdfDirectObject fieldObject : fieldObjects)
    {
      PdfReference fieldReference = (PdfReference)fieldObject;
      PdfArray kidReferences = (PdfArray)File.resolve(
        ((PdfDictionary)fieldReference.getDataObject()).get(PdfName.Kids)
        );
      PdfDictionary kidObject;
      if(kidReferences == null)
      {kidObject = null;}
      else
      {kidObject = (PdfDictionary)((PdfReference)kidReferences.get(0)).getDataObject();}
      // Terminal field?
      if(kidObject == null // Merged single widget annotation.
        || (!kidObject.containsKey(PdfName.FT) // Multiple widget annotations.
          && kidObject.containsKey(PdfName.Subtype)
          && kidObject.get(PdfName.Subtype).equals(PdfName.Widget)))
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

  {
    if(value == null)
    {getBaseDataObject().remove(PdfName.D);}
    else
    {
      PdfArray dashObject = new PdfArray();

      float[] dashArray = value.getDashArray();
      for(
        int dashIndex = 0,
          dashLength = dashArray.length;
        dashIndex < dashLength;
        dashIndex++
        )
      {dashObject.add(new PdfReal(dashArray[dashIndex]));}

      getBaseDataObject().put(PdfName.D, dashObject);
    }
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

    )
  {
    /*
      NOTE: 'Opt' entry may be undefined [PDF:1.6:8.6.3].
    */
    PdfArray items = (PdfArray)File.resolve(getBaseDataObject().get(PdfName.Opt));
    if(items == null)
      return null;

    return new ChoiceItems(
      items,
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

  public boolean addAll(
    int index,
    Collection<? extends Widget> values
    )
  {
    PdfArray items = ensureArray();
    for(Widget value : values)
    {items.add(index++,value.getBaseObject());}

    return true;
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

      values[0] = (T)newWidget(getBaseObject());
    }
    else // Array.
    {
      PdfArray widgetObjects = (PdfArray)baseDataObject;
      if(values.length < widgetObjects.size())
      {values = (T[])new Object[widgetObjects.size()];}

      for(
        int index = 0,
          length = widgetObjects.size();
        index < length;
        index++
        )
      {values[index] = (T)newWidget(widgetObjects.get(index));}
    }
    return values;
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

    )
  {
    PdfDataObject baseDataObject = getBaseDataObject();
    if(baseDataObject instanceof PdfDictionary) // Merged annotation.
    {
      PdfArray widgetsArray = new PdfArray();
      {
        PdfDictionary fieldDictionary = (PdfDictionary)baseDataObject;
        PdfDictionary widgetDictionary = null;
        // Extracting widget entries from the field...
        for(PdfName key : new HashMap<PdfName,PdfDirectObject>(fieldDictionary).keySet())
        {
          // Is it a widget entry?
          if(key.equals(PdfName.Type)
            || key.equals(PdfName.Subtype)
            || key.equals(PdfName.Rect)
            || key.equals(PdfName.Contents)
            || key.equals(PdfName.P)
            || key.equals(PdfName.NM)
            || key.equals(PdfName.M)
            || key.equals(PdfName.F)
            || key.equals(PdfName.BS)
            || key.equals(PdfName.AP)
            || key.equals(PdfName.AS)
            || key.equals(PdfName.Border)
            || key.equals(PdfName.C)
            || key.equals(PdfName.A)
            || key.equals(PdfName.AA)
            || key.equals(PdfName.StructParent)
            || key.equals(PdfName.OC)
            || key.equals(PdfName.H)
            || key.equals(PdfName.MK))
          {
            if(widgetDictionary == null)
            {
              widgetDictionary = new PdfDictionary();
              PdfReference widgetReference = getFile().register(widgetDictionary);

              // Remove the field from the page annotations (as the widget annotation is decoupled from it)!
              PdfArray pageAnnotationsArray = (PdfArray)File.resolve(((PdfDictionary)File.resolve(fieldDictionary.get(PdfName.P))).get(PdfName.Annots));
              pageAnnotationsArray.remove(field.getBaseObject());

              // Add the widget to the page annotations!
              pageAnnotationsArray.add(widgetReference);
              // Add the widget to the field widgets!
              widgetsArray.add(widgetReference);
              // Associate the field to the widget!
              widgetDictionary.put(PdfName.Parent,field.getBaseObject());
            }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

      // Define the action type (in this case: go-to)!
      action.put(new PdfName("S"),new PdfName("GoTo"));
      // Defining the action destination...
      {
        // Create the destination array!
        PdfArray destination = new PdfArray();
        // Define the 2nd page as the destination target!
        destination.add(document.getPages().get(1).getBaseObject());
        // Define the location of the document window on the page (fit vertically)!
        destination.add(new PdfName("FitV"));
        // Define the window's left-edge horizontal coordinate!
        destination.add(new PdfInteger(-32768));
        // Associate the destination to the action!
        action.put(new PdfName("D"),destination);
      }
      // Associate the action to the document!
      document.getBaseDataObject().put(
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.