Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfDirectObject


  private boolean commonAddAll(
    int index,
    Collection<? extends Page> pages
    )
  {
    PdfDirectObject parent;
    PdfDictionary parentData;
    PdfDirectObject kids;
    PdfArray kidsData;
    int offset;
    // Append operation?
    if(index == -1) // Append operation.
    {
      // Get the parent tree node!
      parent = getBaseObject();
      parentData = getBaseDataObject();
      // Get the parent's page collection!
      kids = parentData.get(PdfName.Kids);
      kidsData = (PdfArray)File.resolve(kids);
      offset = 0; // Not used.
    }
    else // Insert operation.
    {
      // Get the page currently at the specified position!
      Page pivotPage = get(index);
      // Get the parent tree node!
      parent = pivotPage.getBaseDataObject().get(PdfName.Parent);
      parentData = (PdfDictionary)File.resolve(parent);
      // Get the parent's page collection!
      kids = parentData.get(PdfName.Kids);
      kidsData = (PdfArray)File.resolve(kids);
      // Get the insertion's relative position within the parent's page collection!
      offset = kidsData.indexOf(pivotPage.getBaseObject());
    }

    // Adding the pages...
    for(Page page : pages)
    {
      // Append?
      if(index == -1) // Append.
      {
        // Append the page to the collection!
        kidsData.add(page.getBaseObject());
      }
      else // Insert.
      {
        // Insert the page into the collection!
        kidsData.add(
          offset++,
          page.getBaseObject()
          );
      }
      // Bind the page to the collection!
      page.getBaseDataObject().put(PdfName.Parent,parent);
      page.update();
    }
    boolean updateParent = !File.update(kids); // Try to update the page collection.

    // Incrementing the pages counters...
    do
    {
      // Get the page collection counter!
      PdfDirectObject count = parentData.get(PdfName.Count);
      PdfInteger countData = (PdfInteger)File.resolve(count);
      // Increment the counter at the current level!
      countData.setValue(countData.getValue()+pages.size());
      updateParent |= !File.update(count); // Try to update the page counter.
      // Is the parent tree node to be updated?
View Full Code Here


  {
    /*
      NOTE: A named destination may be either an array defining the destination,
      or a dictionary with a D entry whose value is such an array [PDF:1.6:8.2.1].
    */
    PdfDirectObject destinationObject;
    {
      PdfDataObject baseDataObject = File.resolve(baseObject);
      if(baseDataObject instanceof PdfDictionary)
      {destinationObject = ((PdfDictionary)baseDataObject).get(PdfName.D);}
      else
View Full Code Here

  @Override
  public AnnotationActions getActions(
    )
  {
    PdfDirectObject actionsObject = getBaseDataObject().get(PdfName.AA);
    if(actionsObject == null)
      return null;

    return new WidgetActions(this,actionsObject,getContainer());
  }
View Full Code Here

    )
  {
    /*
      NOTE: 'MK' entry may be undefined.
    */
    PdfDirectObject appearanceObject = getBaseDataObject().get(PdfName.MK);
    if(appearanceObject == null)
      return null;

    return new AppearanceCharacteristics(appearanceObject,getContainer());
  }
View Full Code Here

    )
  {
    /*
      NOTE: 'IF' entry may be undefined.
    */
    PdfDirectObject iconFitObject = getBaseDataObject().get(PdfName.IF);
    if(iconFitObject == null)
      return null;

    return new IconFitObject(iconFitObject,getContainer());
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfDirectObject

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.