CreateEmbeddedFile(String, ReadOnlySpan, PdfEmbeddedFileOptions?) Method

Definition

Namespace Broadside
Assembly Broadside.dll

Embeds contents as a new embedded file stream and returns a new file specification for it, attached to nothing yet.

public PdfFileSpecification CreateEmbeddedFile(string fileName, ReadOnlySpan<byte> contents, PdfEmbeddedFileOptions? options = null)

Parameters

fileName
String

The file's name, written to the specification's UF (as a text string) and F.

contents
ReadOnlySpan<Byte>

The file's bytes; copied.

options
PdfEmbeddedFileOptions

Media type, description, dates and relationship; null for the defaults.

Returns

Remarks

ISO 32000-2 §7.11.3, Table 43, and §7.11.4, Tables 44 and 45. Two new indirect objects: the stream (Type EmbeddedFile, Subtype, and Params with Size, the MD5 CheckSum and the dates given) and the specification (Type Filespec, F, UF, EF with F and UF, and Desc and AFRelationship when given). The stream is written unfiltered and compressed by the save (StreamCompression).

A solidus in fileName is written escaped (\/, §7.11.2.1) so the name stays one component. F holds the name in PDFDocEncoding, with _ for each character it cannot encode; UF holds it exactly. Minimum versions: embedded file streams PDF 1.3, Desc 1.6, UF 1.7, AFRelationship 2.0; a later save raises the document's version to the highest one used, or refuses in strict mode. A mutation: no read may run concurrently with it.