Table of Contents

Class PdfFileSpecification

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

Specifies a file or an URL. The file can be extern or embedded. @author Paulo Soares (psoares@consiste.pt)

public class PdfFileSpecification : PdfDictionary
Inheritance
PdfFileSpecification
Inherited Members

Constructors

PdfFileSpecification()

Creates a new instance of PdfFileSpecification. The static methods are preferred.

public PdfFileSpecification()

Fields

Refi

protected PdfIndirectReference Refi

Field Value

PdfIndirectReference

Writer

protected PdfWriter Writer

Field Value

PdfWriter

Properties

MultiByteFileName

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

public byte[] MultiByteFileName { set; }

Property Value

byte[]

Reference

Gets the indirect reference to this file specification. Multiple invocations will retrieve the same value. @throws IOException on error

public PdfIndirectReference Reference { get; }

Property Value

PdfIndirectReference

the indirect reference

Volatile

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.

public bool Volatile { set; }

Property Value

bool

Methods

AddCollectionItem(PdfCollectionItem)

Adds the Collection item dictionary.

public void AddCollectionItem(PdfCollectionItem ci)

Parameters

ci PdfCollectionItem

AddDescription(string, bool)

Adds a description for the file that is specified here.

public void AddDescription(string description, bool unicode)

Parameters

description string

some text

unicode bool

if true, the text is added as a unicode string

FileEmbedded(PdfWriter, string, string, byte[])

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. it takes precedence over filePath @throws IOException on error

public static PdfFileSpecification FileEmbedded(PdfWriter writer, string filePath, string fileDisplay, byte[] fileStore)

Parameters

writer PdfWriter

the PdfWriter

filePath string

the file path

fileDisplay string

the file information that is presented to the user

fileStore byte[]

the byte array with the file. If it is not null

Returns

PdfFileSpecification

the file specification

FileEmbedded(PdfWriter, string, string, byte[], bool)

Creates a file specification with the file embedded. The file may come from the file system or from a byte array. it takes precedence over filePath from compression @throws IOException on error

public static PdfFileSpecification FileEmbedded(PdfWriter writer, string filePath, string fileDisplay, byte[] fileStore, bool compress)

Parameters

writer PdfWriter

the PdfWriter

filePath string

the file path

fileDisplay string

the file information that is presented to the user

fileStore byte[]

the byte array with the file. If it is not null

compress bool

sets the compression on the data. Multimedia content will benefit little

Returns

PdfFileSpecification

the file specification

FileEmbedded(PdfWriter, string, string, byte[], bool, string, PdfDictionary)

Creates a file specification with the file embedded. The file may come from the file system or from a byte array. it takes precedence over filePath from compression @throws IOException on error

public static PdfFileSpecification FileEmbedded(PdfWriter writer, string filePath, string fileDisplay, byte[] fileStore, bool compress, string mimeType, PdfDictionary fileParameter)

Parameters

writer PdfWriter

the PdfWriter

filePath string

the file path

fileDisplay string

the file information that is presented to the user

fileStore byte[]

the byte array with the file. If it is not null

compress bool

sets the compression on the data. Multimedia content will benefit little

mimeType string

the optional mimeType

fileParameter PdfDictionary

the optional extra file parameters such as the creation or modification date

Returns

PdfFileSpecification

the file specification

FileEmbedded(PdfWriter, string, string, byte[], int)

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. it takes precedence over filePath it takes precedence over filePath @throws IOException on error @since 2.1.3

public static PdfFileSpecification FileEmbedded(PdfWriter writer, string filePath, string fileDisplay, byte[] fileStore, int compressionLevel)

Parameters

writer PdfWriter

the PdfWriter

filePath string

the file path

fileDisplay string

the file information that is presented to the user

fileStore byte[]

the byte array with the file. If it is not null

compressionLevel int

the compression level to be used for compressing the file

Returns

PdfFileSpecification

the file specification

FileEmbedded(PdfWriter, string, string, byte[], string, PdfDictionary, int)

Creates a file specification with the file embedded. The file may come from the file system or from a byte array. it takes precedence over filePath @throws IOException on error @since 2.1.3

public static PdfFileSpecification FileEmbedded(PdfWriter writer, string filePath, string fileDisplay, byte[] fileStore, string mimeType, PdfDictionary fileParameter, int compressionLevel)

Parameters

writer PdfWriter

the PdfWriter

filePath string

the file path

fileDisplay string

the file information that is presented to the user

fileStore byte[]

the byte array with the file. If it is not null

mimeType string

the optional mimeType

fileParameter PdfDictionary

the optional extra file parameters such as the creation or modification date

compressionLevel int

the level of compression

Returns

PdfFileSpecification

the file specification

FileExtern(PdfWriter, string)

Creates a file specification for an external file.

public static PdfFileSpecification FileExtern(PdfWriter writer, string filePath)

Parameters

writer PdfWriter

the PdfWriter

filePath string

the file path

Returns

PdfFileSpecification

the file specification

SetUnicodeFileName(string, bool)

Adds the unicode file name (the key /UF). This entry was introduced in PDF 1.7. The filename must have the slash and backslash escaped according to the file specification rules.

public void SetUnicodeFileName(string filename, bool unicode)

Parameters

filename string

the filename

unicode bool

if true, the filename is UTF-16BE encoded; otherwise PDFDocEncoding is used;

Url(PdfWriter, string)

Creates a file specification of type URL.

public static PdfFileSpecification Url(PdfWriter writer, string url)

Parameters

writer PdfWriter

the PdfWriter

url string

the URL

Returns

PdfFileSpecification

the file specification