Class EmbeddedFile


  • public class EmbeddedFile
    extends Object
    Files in PDF documents may be associated either with the document as a whole, or with annotations that are located on a single page in a particular location. Files in PDF documents may be concretely embedded — in which case their content will be carried in full within the source PDF and be available via getContent() — or they may be referentially "embedded", in which case the files' contents will only be available via a URL provided by getFileLocation().
    Since:
    v3.0.0
    Version:
    ©2004-2024 Snowtide
    • Method Detail

      • getDescription

        public String getDescription()
        Returns the user-specified description of this file.
      • isContentVolatile

        public boolean isContentVolatile()
        Returns true if the contents of this file should be expected to change over time. This is generally the case only if getFileLocation() is a remote URL, indicating that this "embedded file" is really just a reference.
      • getFileLocation

        public String getFileLocation()
        Returns a "specification" of the location of the file. This can be any of:
        • a simple filename, e.g. "data.csv"
        • a path, likely copied exactly when the source PDF was generated, e.g. "C:\directory\ data.csv"
        • a URL indicating that the referred file content is available only via network connection, e.g. http://youtube.com/...
        In the last case, getContent() will likely return null.
      • getContent

        public byte[] getContent()
                          throws IOException
        Returns the data associated with this file, as embedded in the source document. Will return null if the file's data is not actually carried by the source document (e.g. as when file's location is a remote URL).
        Throws:
        IOException - if an error occurs reading the file's content