Class PdfFileSpecification
java.lang.Object
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfObject
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfDictionary
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfFileSpecification
Specifies a file or an URL. The file can be extern or embedded.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfFileSpecificationfileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore) Creates a file specification with the file embedded.static PdfFileSpecificationfileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore, boolean compress) Creates a file specification with the file embedded.static PdfFileSpecificationfileExtern(PdfWriter writer, String filePath) Creates a file specification for an external file.Gets the indirect reference to this file specification.static PdfFileSpecificationCreates a file specification of type URL.Methods inherited from class PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isDictionaryType, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putDel, putEx, remove, size, toPdfMethods inherited from class PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, toString, type
-
Field Details
-
writer
-
ref
-
-
Constructor Details
-
PdfFileSpecification
public PdfFileSpecification()Creates a new instance of PdfFileSpecification. The static methods are preferred.
-
-
Method Details
-
url
Creates a file specification of type URL.- Parameters:
writer- thePdfWriterurl- the URL- Returns:
- the file specification
-
fileEmbedded
public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore) throws IOException Creates a file specification with the file embedded. The file may come from the file system or from a byte array. The data is flate compressed.- Parameters:
writer- thePdfWriterfilePath- the file pathfileDisplay- the file information that is presented to the userfileStore- the byte array with the file. If it is notnullit takes precedence overfilePath- Returns:
- the file specification
- Throws:
IOException- on error
-
fileEmbedded
public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore, boolean compress) throws IOException Creates a file specification with the file embedded. The file may come from the file system or from a byte array.- Parameters:
writer- thePdfWriterfilePath- the file pathfileDisplay- the file information that is presented to the userfileStore- the byte array with the file. If it is notnullit takes precedence overfilePathcompress- sets the compression on the data. Multimedia content will benefit little from compression- Returns:
- the file specification
- Throws:
IOException- on error
-
fileExtern
Creates a file specification for an external file.- Parameters:
writer- thePdfWriterfilePath- the file path- Returns:
- the file specification
-
getReference
Gets the indirect reference to this file specification. Multiple invocations will retrieve the same value.- Returns:
- the indirect reference
- Throws:
IOException- on error
-