Examples of PdfDictionary


Examples of org.pdfclown.objects.PdfDictionary

    Document context
    )
  {
    super(
      context.getFile(),
      new PdfDictionary()
      );
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    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());
            }

            // Transfer the entry from the field to the widget!
            widgetDictionary.put(key,fieldDictionary.get(key));
            fieldDictionary.remove(key);
          }
        }
      }
      setBaseObject(widgetsArray);
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    // 2. Modifying the document...
    Document document = file.getDocument();
    {
      // Create the action dictionary!
      PdfDictionary action = new PdfDictionary();
      // 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(
        new PdfName("OpenAction"),
        file.register(action) // Adds the action to the file, returning its reference.
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

      NOTE: This is a factory method for any annotation-derived object.
    */
    if(baseObject == null)
      return null;

    PdfDictionary dataObject = (PdfDictionary)File.resolve(baseObject);
    if(!dataObject.get(PdfName.Type).equals(PdfName.Annot))
      return null;

    PdfName annotationType = (PdfName)dataObject.get(PdfName.Subtype);
    if(annotationType.equals(PdfName.Text))
      return new Note(baseObject,container);
    else if(annotationType.equals(PdfName.Link))
      return new Link(baseObject,container);
    else if(annotationType.equals(PdfName.FreeText))
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    Page page
    )
  {
    super(
      context.getFile(),
      new PdfDictionary(
        new PdfName[]
        {
          PdfName.Type,
          PdfName.Subtype,
          PdfName.P,
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    Document context
    )
  {
    super(
      context.getFile(),
      new PdfDictionary(
        new PdfName[]
        {
          PdfName.Type,
          PdfName.Count
        },
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

            Encoding.encode((String)token),
            PdfString.SerializationModeEnum.Literal
            );
        case DictionaryBegin:
          {
            PdfDictionary dictionary = new PdfDictionary();
            // Populate the dictionary.
            while(true)
            {
              // Key.
              moveNext();
              if(tokenType == TokenTypeEnum.DictionaryEnd)
                break;
              PdfName key = (PdfName)parsePdfObject();

              // Value.
              moveNext();
              PdfDirectObject value = parsePdfObject();

              // Add the current entry to the dictionary!
              dictionary.put(key,value);
            }
            return dictionary;
          }
        case ArrayBegin:
          {
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    Document context
    )
  {
    super(
      context.getFile(),
      new PdfDictionary(
        new PdfName[]
        {PdfName.Fields},
        new PdfDirectObject[]
        {new PdfArray()}
        )
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    String title
    )
  {
    super(
      context.getFile(),
      new PdfDictionary()
      );
    setTitle(title);
  }
View Full Code Here

Examples of org.pdfclown.objects.PdfDictionary

    Document context
    )
  {
    super(
      context.getFile(),
      new PdfDictionary()
      );
  }
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.