public class PdfFileSpecification extends PdfDictionary
| Modifier and Type | Field | Description |
|---|---|---|
protected PdfIndirectReference |
ref |
|
protected PdfWriter |
writer |
| Constructor | Description |
|---|---|
PdfFileSpecification() |
Creates a new instance of PdfFileSpecification.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addCollectionItem(PdfCollectionItem ci) |
Adds the Collection item dictionary.
|
void |
addDescription(String description,
boolean unicode) |
Adds a description for the file that is specified here.
|
static PdfFileSpecification |
fileEmbedded(PdfWriter writer,
String filePath,
String fileDisplay,
byte[] fileStore) |
Creates a file specification with the file embedded.
|
static PdfFileSpecification |
fileEmbedded(PdfWriter writer,
String filePath,
String fileDisplay,
byte[] fileStore,
boolean compress) |
Creates a file specification with the file embedded.
|
static PdfFileSpecification |
fileEmbedded(PdfWriter writer,
String filePath,
String fileDisplay,
byte[] fileStore,
boolean compress,
String mimeType,
PdfDictionary fileParameter) |
Creates a file specification with the file embedded.
|
static PdfFileSpecification |
fileEmbedded(PdfWriter writer,
String filePath,
String fileDisplay,
byte[] fileStore,
int compressionLevel) |
Creates a file specification with the file embedded.
|
static PdfFileSpecification |
fileEmbedded(PdfWriter writer,
String filePath,
String fileDisplay,
byte[] fileStore,
String mimeType,
PdfDictionary fileParameter,
int compressionLevel) |
Creates a file specification with the file embedded.
|
static PdfFileSpecification |
fileExtern(PdfWriter writer,
String filePath) |
Creates a file specification for an external file.
|
PdfIndirectReference |
getReference() |
Gets the indirect reference to this file specification.
|
void |
setMultiByteFileName(byte[] fileName) |
Sets the file name (the key /F) string as an hex representation
to support multi byte file names.
|
void |
setUnicodeFileName(String filename,
boolean unicode) |
Adds the unicode file name (the key /UF).
|
void |
setVolatile(boolean volatile_file) |
Sets a flag that indicates whether an external file referenced by the file
specification is volatile.
|
void |
toPdf(PdfWriter writer,
OutputStream os) |
Writes the PDF representation of this
PdfDictionary as an
array of byte to the given OutputStream. |
static PdfFileSpecification |
url(PdfWriter writer,
String url) |
Creates a file specification of type URL.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckType, clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toStringcanBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, typeprotected PdfWriter writer
protected PdfIndirectReference ref
public PdfFileSpecification()
public static PdfFileSpecification url(PdfWriter writer, String url)
writer - the PdfWriterurl - the URLpublic static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore) throws IOException
writer - the PdfWriterfilePath - the file pathfileDisplay - the file information that is presented to the userfileStore - the byte array with the file. If it is not null
it takes precedence over filePathIOException - on errorpublic static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore, int compressionLevel) throws IOException
writer - the PdfWriterfilePath - the file pathfileDisplay - the file information that is presented to the userfileStore - the byte array with the file. If it is not null
it takes precedence over filePathcompressionLevel - the compression level to be used for compressing the file
it takes precedence over filePathIOException - on errorpublic static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore, boolean compress) throws IOException
writer - the PdfWriterfilePath - the file pathfileDisplay - the file information that is presented to the userfileStore - the byte array with the file. If it is not null
it takes precedence over filePathcompress - sets the compression on the data. Multimedia content will benefit little
from compressionIOException - on errorpublic static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore, boolean compress, String mimeType, PdfDictionary fileParameter) throws IOException
writer - the PdfWriterfilePath - the file pathfileDisplay - the file information that is presented to the userfileStore - the byte array with the file. If it is not null
it takes precedence over filePathcompress - sets the compression on the data. Multimedia content will benefit little
from compressionmimeType - the optional mimeTypefileParameter - the optional extra file parameters such as the creation or modification dateIOException - on errorpublic static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte[] fileStore, String mimeType, PdfDictionary fileParameter, int compressionLevel) throws IOException
writer - the PdfWriterfilePath - the file pathfileDisplay - the file information that is presented to the userfileStore - the byte array with the file. If it is not null
it takes precedence over filePathmimeType - the optional mimeTypefileParameter - the optional extra file parameters such as the creation or modification datecompressionLevel - the level of compressionIOException - on errorpublic static PdfFileSpecification fileExtern(PdfWriter writer, String filePath)
writer - the PdfWriterfilePath - the file pathpublic PdfIndirectReference getReference() throws IOException
IOException - on errorpublic void setMultiByteFileName(byte[] fileName)
fileName - the file name as a byte arraypublic void setUnicodeFileName(String filename, boolean unicode)
filename - the filenameunicode - if true, the filename is UTF-16BE encoded; otherwise PDFDocEncoding is used;public void setVolatile(boolean volatile_file)
volatile_file - if true, the external file should not be cachedpublic void addDescription(String description, boolean unicode)
description - some textunicode - if true, the text is added as a unicode stringpublic void addCollectionItem(PdfCollectionItem ci)
public void toPdf(PdfWriter writer, OutputStream os) throws IOException
PdfDictionaryPdfDictionary as an
array of byte to the given OutputStream.toPdf in class PdfDictionarywriter - for backwards compatibilityos - the OutputStream to write the bytes to.IOExceptionCopyright © 2018. All rights reserved.