Class FileAttachment

java.lang.Object
com.datalogics.PDFL.FileAttachment

public class FileAttachment extends Object
A file attachment. Any file can be attached to the PDF document. The class allows to create attachment and manipulate by its content.
  • Constructor Details

    • FileAttachment

      public FileAttachment(Document doc, String fileName)
      Allows to add attachment into the PDF document.

      Parameters:
      doc - The PDF document (reference).
      fileName - The path to file which will be attached to the document.
    • FileAttachment

      public FileAttachment(Document doc, String fileName, String keyName)
      Allows to add attachment into the PDF document using the specified key name.

      Parameters:
      doc - The PDF document (reference).
      fileName - The path to file which will be attached to the document.
      keyName - The name of the key.
  • Method Details

    • delete

      public void delete()
    • saveToStream

      public void saveToStream(ImageOutputStream stream) throws IOException
      Saves a FileAttachment to a javax.imageio.stream.ImageInputStream.
      Parameters:
      stream - The stream from which to save the FileAttachment.
      Throws:
      IOException
    • saveToFile

      public void saveToFile(String fileName)
      Allows to save attachment to the specified file.

      Parameters:
      fileName - The path where attachment will be saved.
    • updateFromFile

      public void updateFromFile(String fileName)
      Allows to update attachment from another file.

      Parameters:
      fileName - The path to the file from which attachment will be updated.
    • getFileSize

      public long getFileSize()
      Allows to obtain attachment's size.

      Returns:
      The attachment's size in bytes.
    • getFileName

      public String getFileName()
      Allow to obtain attachment's file name.

      Returns:
      The attachment's file name.
    • setCollectionItemNumber

      public void setCollectionItemNumber(CollectionSchemaField collectionField, float value)
      SetCollectionItemNumber allows to add key to the collection item dictionary.
      Parameters:
      collectionField - schema field which contains information about data type. The parameter's subtype should be a Number.
      value - the item's value.
    • getCollectionItemNumber

      public float getCollectionItemNumber(CollectionSchemaField collectionField)
      GetCollectionItemNumber allows to obtain collection item according to the specified schema field.
      Parameters:
      collectionField - the field for which item value should be retrieved.
      Returns:
      collection items value
    • setCollectionItemString

      public void setCollectionItemString(CollectionSchemaField collectionField, String value)
      SetCollectionItemString allows to add key to the collection item dictionary.
      Parameters:
      collectionField - schema field which contains information about data type. The parameter's subtype should be a Text.
      value - the item's value.
    • getCollectionItemString

      public String getCollectionItemString(CollectionSchemaField collectionField)
      GetCollectionItemString allows to obtain collection item value according to the specified schema field.
      Parameters:
      collectionField - the field for which item value should be retrieved.
      Returns:
      collection items value