Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfDictionary


    Document context
    )
  {
    super(
      context.getFile(),
      new PdfDictionary()
      );

    try
    {
      Package package_ = getClass().getPackage();
View Full Code Here


  // <dynamic>
  // <constructors>
  public PageActions(
    Document context
    )
  {super(context.getFile(), new PdfDictionary());}
View Full Code Here

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

    )
  {
    // 1. Showing basic page information...
    System.out.println(" Index (calculated): " + page.getIndex() + " (should be " + index + ")");
    System.out.println(" ID: " + ((PdfReference)page.getBaseObject()).getId());
    PdfDictionary pageDictionary = page.getBaseDataObject();
    System.out.println(" Dictionary entries:");
    for(PdfName key : pageDictionary.keySet())
    {System.out.println("  " + key.getValue());}

    // 2. Showing page contents information...
    Contents contents = page.getContents();
    System.out.println(" Content objects count: " + contents.size());
View Full Code Here

    Resources resources
    )
  {
    super(
      context.getFile(),
      new PdfDictionary(
        new PdfName[]
        {
          PdfName.Type,
          PdfName.MediaBox,
          PdfName.Contents,
View Full Code Here

      TODO: 'Annots' entry must be finely treated to include any non-circular reference.
    */
    // TODO:IMPL deal with inheritable attributes!!!

    File contextFile = context.getFile();
    PdfDictionary clone = new PdfDictionary(getBaseDataObject().size());
    for(Map.Entry<PdfName,PdfDirectObject> entry : getBaseDataObject().entrySet())
    {
      PdfName key = entry.getKey();
      // Is the entry unwanted?
      if(key.equals(PdfName.Parent)
        || key.equals(PdfName.Annots))
        continue;

      // Insert the clone of the entry into the clone of the page dictionary!
      clone.put(
        key,
        (PdfDirectObject)entry.getValue().clone(contextFile)
        );
    }
    return new Page(contextFile.getIndirectObjects().add(clone).getReference());
View Full Code Here

      collecting page counts. At each level we'll scan the kids array from the
      lower-indexed item to the ancestor of this page object at that level.
    */
    PdfReference ancestorKidReference = (PdfReference)getBaseObject();
    PdfReference parentReference = (PdfReference)getBaseDataObject().get(PdfName.Parent);
    PdfDictionary parent = (PdfDictionary)File.resolve(parentReference);
    PdfArray kids = (PdfArray)File.resolve(parent.get(PdfName.Kids));
    int index = 0;
    for(
      int i = 0;
      true;
      i++
      )
    {
      PdfReference kidReference = (PdfReference)kids.get(i);
      // Is the current-level counting complete?
      // NOTE: It's complete when it reaches the ancestor at the current level.
      if(kidReference.equals(ancestorKidReference)) // Ancestor node.
      {
        // Does the current level correspond to the page-tree root node?
        if(!parent.containsKey(PdfName.Parent))
        {
          // We reached the top: counting's finished.
          return index;
        }
        // Set the ancestor at the next level!
        ancestorKidReference = parentReference;
        // Move up one level!
        parentReference = (PdfReference)parent.get(PdfName.Parent);
        parent = (PdfDictionary)File.resolve(parentReference);
        kids = (PdfArray)File.resolve(parent.get(PdfName.Kids));
        i = -1;
      }
      else // Intermediate node.
      {
        PdfDictionary kid = (PdfDictionary)File.resolve(kidReference);
        if(kid.get(PdfName.Type).equals(PdfName.Page))
          index++;
        else
          index += ((PdfInteger)kid.get(PdfName.Count)).getRawValue();
      }
    }
  }
View Full Code Here

    FormXObject form = new FormXObject(context);
    PdfStream formStream = form.getBaseDataObject();

    // Header.
    {
      PdfDictionary formHeader = formStream.getHeader();
      // Bounding box.
      formHeader.put(
        PdfName.BBox,
        (PdfDirectObject)getInheritableAttribute(PdfName.MediaBox).clone(contextFile)
        );
      // Resources.
      {
        PdfDirectObject resourcesObject = getInheritableAttribute(PdfName.Resources);
        formHeader.put(
          PdfName.Resources,
          // Same document?
          /* NOTE: Try to reuse the resource dictionary whenever possible. */
          (context.equals(getDocument()) ?
            resourcesObject
View Full Code Here

    )
  {
    /*
      NOTE: It moves upward until it finds the inherited attribute.
    */
    PdfDictionary dictionary = getBaseDataObject();
    while(true)
    {
      PdfDirectObject entry = dictionary.get(key);
      if(entry != null)
        return entry;

      dictionary = (PdfDictionary)File.resolve(
        dictionary.get(PdfName.Parent)
        );
      if(dictionary == null)
      {
        // Isn't the page attached to the page tree?
        /* NOTE: This condition is illegal. */
 
View Full Code Here

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

TOP

Related Classes of org.pdfclown.objects.PdfDictionary

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.