Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfDataObject


    Contents contents,
    DefaultTableModel model
    )
  {
    List<PdfDataObject> streamObjects = new ArrayList<PdfDataObject>();
    PdfDataObject contentsDataObject = contents.getBaseDataObject();
    if(contentsDataObject instanceof PdfArray)
    {streamObjects.addAll((List<PdfDirectObject>)contentsDataObject);}
    else
    {streamObjects.add(contentsDataObject);}
View Full Code Here


  public PdfDataObject put(
    Integer key,
    PdfDataObject value
    )
  {
    PdfDataObject removedDataObject = null;
    {
      ObjectEntry removedEntry = getEntries().put(key,new ObjectEntry(value));
      if(removedEntry != null)
      {removedDataObject = removedEntry.getDataObject();}
    }
View Full Code Here

  @Override
  public PdfDataObject remove(
    Object key
    )
  {
    PdfDataObject removedDataObject = null;
    {
      ObjectEntry removedEntry = getEntries().remove(key);
      if(removedEntry != null)
      {removedDataObject = removedEntry.getDataObject();}
    }
View Full Code Here

  private void fillObjects(
    PdfDataObject objectObject,
    Collection<PdfObjectWrapper<?>> objects
    )
  {
    PdfDataObject objectDataObject = File.resolve(objectObject);
    if(objectDataObject instanceof PdfArray) // Multiple objects.
    {
      for(PdfDirectObject itemObject : (PdfArray)objectDataObject)
      {fillObjects(itemObject,objects);}
    }
    else // Single object.
    {
      if(objectDataObject instanceof PdfDictionary) // Annotation.
        objects.add(
          Annotation.wrap((PdfReference)objectObject)
          );
      else if(objectDataObject instanceof PdfTextString) // Form field (associated to widget annotations).
        objects.add(
          getDocument().getForm().getFields().get(
            (String)((PdfTextString)objectDataObject).getValue()
            )
          );
      else // Invalid object type.
        throw new RuntimeException(
          "Invalid 'Hide' action target type (" + objectDataObject.getClass().getName() + ").\n"
            + "It should be either an annotation or a form field."
          );
    }
  }
View Full Code Here

    )
  {
    /*
      NOTE: 'JS' entry MUST be defined.
    */
    PdfDataObject scriptObject = getBaseDataObject().get(PdfName.JS);
    if(scriptObject instanceof PdfTextString)
    {return ((PdfTextString)scriptObject).getValue();}
    else
    {
      IBuffer scriptBuffer = ((PdfStream)scriptObject).getBody();
View Full Code Here

    )
  {
    /*
      NOTE: 'JS' entry MUST be defined.
    */
    PdfDataObject scriptObject = getBaseDataObject().get(PdfName.JS);
    if(scriptObject instanceof PdfTextString)
    {((PdfTextString)scriptObject).setValue(value);}
    else
    {
      IBuffer scriptBuffer = ((PdfStream)scriptObject).getBody();
View Full Code Here

    // 2. Iterating through the indirect object collection...
    int index = 0;
    for(PdfIndirectObject indirectObject : file.getIndirectObjects())
    {
      // Get the data object associated to the indirect object!
      PdfDataObject dataObject = indirectObject.getDataObject();
      // Is this data object a stream?
      if(dataObject instanceof PdfStream)
      {
        PdfDictionary header = ((PdfStream)dataObject).getHeader();
        // Is this stream an image?
View Full Code Here

  @Override
  public Action get(
    int index
    )
  {
    PdfDataObject baseDataObject = getBaseDataObject();
    if(baseDataObject instanceof PdfDictionary) // Single action.
    {
      if(index != 0)
        throw new IndexOutOfBoundsException("Index: " + index + ", Size: 1");
View Full Code Here

    )
  {
    if(!(value instanceof Action))
      return -1;

    PdfDataObject baseDataObject = getBaseDataObject();
    if(baseDataObject instanceof PdfDictionary) // Single action.
      return (((Action)value).getBaseObject().equals(getBaseObject()) ? 0 : -1);
    else // Multiple actions.
      return ((PdfArray)baseDataObject).indexOf(((Action)value).getBaseObject());
  }
View Full Code Here

    )
  {
    if(!(value instanceof Action))
      return false;

    PdfDataObject baseDataObject = getBaseDataObject();
    if(baseDataObject instanceof PdfDictionary) // Single action.
      return ((Action)value).getBaseObject().equals(getBaseObject());
    else // Multiple actions.
      return ((PdfArray)baseDataObject).contains(((Action)value).getBaseObject());
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfDataObject

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.