Class PdfFileSpecification
java.lang.Object
com.aowagie.text.pdf.PdfObject
com.aowagie.text.pdf.PdfDictionary
com.aowagie.text.pdf.PdfFileSpecification
Specifies a file or an URL. The file can be extern or embedded.
- Author:
- Paulo Soares (psoares@consiste.pt)
-
Field Summary
Fields inherited from class PdfDictionary
hashMap -
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 PdfFileSpecificationfileExtern(PdfWriter writer, String filePath) Creates a file specification for an external file.Gets the indirect reference to this file specification.voidsetMultiByteFileName(byte[] fileName) Sets the file name (the key /F) string as an hex representation to support multi byte file names.voidsetVolatile(boolean volatile_file) Sets a flag that indicates whether an external file referenced by the file specification is volatile.Methods inherited from class PdfDictionary
get, getAsArray, getAsDict, getAsName, getAsNumber, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, put, remove, size, toPdf, toStringMethods inherited from class PdfObject
getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, setContent, setIndRef, type
-
Constructor Details
-
PdfFileSpecification
public PdfFileSpecification()Creates a new instance of PdfFileSpecification. The static methods are preferred.
-
-
Method Details
-
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
-
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
-
setMultiByteFileName
public void setMultiByteFileName(byte[] fileName) Sets the file name (the key /F) string as an hex representation to support multi byte file names. The name must have the slash and backslash escaped according to the file specification rules- Parameters:
fileName- the file name as a byte array
-
setVolatile
public void setVolatile(boolean volatile_file) Sets a flag that indicates whether an external file referenced by the file specification is volatile. If the value is true, applications should never cache a copy of the file.- Parameters:
volatile_file- if true, the external file should not be cached
-