Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfArray


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

    return true;
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  public <T> T[] toArray(
    T[] values
    )
  {
    PdfArray annotationObjects = getBaseDataObject();
    if(values.length < annotationObjects.size())
    {values = (T[])new Object[annotationObjects.size()];}

    PdfIndirectObject container = getContainer();
    for(
      int index = 0,
        length = annotationObjects.size();
      index < length;
      index++
      )
    {values[index] = (T)Annotation.wrap(annotationObjects.get(index),container);}
    return values;
  }
View Full Code Here

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

  @Override
  public boolean containsKey(
    Object key
    )
  {
    PdfArray itemPairs = getBaseDataObject();
    for(
      int index = 0,
        length = itemPairs.size();
      index < length;
      index += 2
      )
    {
      if(((PdfTextString)itemPairs.get(index)).getValue().equals(key))
        return true;
    }

    return false;
  }
View Full Code Here

  @Override
  public boolean containsValue(
    Object value
    )
  {
    PdfArray itemPairs = getBaseDataObject();
    for(
      int index = 1,
        length = itemPairs.size();
      index < length;
      index += 2
      )
    {
      if(itemPairs.get(index).equals(value))
        return true;
    }

    return false;
  }
View Full Code Here

  @Override
  public Set<Map.Entry<String,EmbeddedFile>> entrySet(
    )
  {
    HashSet<Map.Entry<String,EmbeddedFile>> entrySet = new HashSet<Map.Entry<String,EmbeddedFile>>();
    PdfArray itemPairs = getBaseDataObject();
    for(
      int index = 0,
        length = itemPairs.size();
      index < length;
      index += 2
      )
    {
      entrySet.add(
        new Entry(
          (String)((PdfTextString)itemPairs.get(index)).getValue(),
          new EmbeddedFile(itemPairs.get(index+1))
          )
        );
    }

    return entrySet;
View Full Code Here

  @Override
  public EmbeddedFile get(
    Object key
    )
  {
    PdfArray itemPairs = getBaseDataObject();
    for(
      int index = 0,
        length = itemPairs.size();
      index < length;
      index += 2
      )
    {
      if(((PdfTextString)itemPairs.get(index)).getValue().equals(key))
        return new EmbeddedFile(itemPairs.get(index+1));
    }

    return null;
  }
View Full Code Here

  {
    /*
      NOTE: Due to the contract,
      we cannot force the existence of the default media box at document level.
    */
    PdfArray mediaBox = getMediaBox();
    if(mediaBox == null)
      return null;

    return new Dimension(
      ((PdfNumber<?>)mediaBox.get(2)).getValue().intValue(),
      ((PdfNumber<?>)mediaBox.get(3)).getValue().intValue()
      );
  }
View Full Code Here

  @Override
  public Set<String> keySet(
    )
  {
    HashSet<String> keySet = new HashSet<String>();
    PdfArray itemPairs = getBaseDataObject();
    for(
      int index = 0,
        length = itemPairs.size();
      index < length;
      index += 2
      )
    {
      keySet.add(
        (String)((PdfTextString)itemPairs.get(index)).getValue()
        );
    }

    return keySet;
  }
View Full Code Here

  */
  public void setPageSize(
    Dimension2D value
    )
  {
    PdfArray mediaBox = getMediaBox();
    if(mediaBox == null)
    {
      // Create default media box!
      mediaBox = new Rectangle(0,0,0,0).getBaseDataObject();
      // Assign the media box to the document!
      ((PdfDictionary)getBaseDataObject().resolve(PdfName.Pages)).put(PdfName.MediaBox,mediaBox);
    }
    mediaBox.set(2,new PdfReal(value.getWidth()));
    mediaBox.set(3,new PdfReal(value.getHeight()));
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfArray

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.