Package com.snowtide.pdf
Class EmbeddedFile
- java.lang.Object
-
- com.snowtide.pdf.EmbeddedFile
-
public class EmbeddedFile extends Object
Files in PDF documents may be associated either withthe document as a whole
, or withannotations
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 viagetContent()
— or they may be referentially "embedded", in which case the files' contents will only be available via a URL provided bygetFileLocation()
.- Since:
- v3.0.0
- Version:
- ©2004-2024 Snowtide
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getContent()
Returns the data associated with this file, as embedded in the source document.String
getDescription()
Returns the user-specified description of this file.String
getFileLocation()
Returns a "specification" of the location of the file.boolean
isContentVolatile()
Returns true if the contents of this file should be expected to change over time.
-
-
-
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 ifgetFileLocation()
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/...
getContent()
will likely returnnull
. - a simple filename, e.g.
-
getContent
public byte[] getContent() throws IOException
Returns the data associated with this file, as embedded in the source document. Will returnnull
if the file's data is not actually carried by the source document (e.g. as whenfile's location
is a remote URL).- Throws:
IOException
- if an error occurs reading the file's content
-
-