Click or drag to resize
Pdftools logo

ConverterAddAssociatedFile Method

Prepares the associated file for embedding.

Add a file to the document’s embedded files. For PDF/A-3, the embedded file is associated with an object of the document, i.e. it is an associated file. The file is embedded as-is. Embedding files is not allowed for PDF/A-1 and restricted to PDF/A conforming files for PDF/A-2.

Namespace: PdfTools.PdfA.Conversion
Assembly: PdfTools (in PdfTools.dll) Version: 1.8.0+c1110cafb37403de0188424e1c97e84e318ca892
Syntax
C#
public void AddAssociatedFile(
	Stream embeddedFile,
	string name,
	int? associate = null,
	AFRelationship? afRelationship = null,
	string mimeType = null,
	string description = null,
	DateTimeOffset? modificationDate = null
)

Parameters

embeddedFile  Stream
The stream of the embedded file.
name  String
The name used for the embedded file. This name is presented to the user when viewing the list of embedded files.
associate  NullableInt32  (Optional)
The object to associate the embedded file with, -1 for none, 0 for document, number greater than 0 for respective page. If , the default value is 0 for PDF/A-3 and -1 otherwise.
afRelationship  NullableAFRelationship  (Optional)
The relationship of the embedded file to the object associate. (Ignored, if associate is -1.) If , the default value is Unspecified.
mimeType  String  (Optional)
MIME ­Type of the embedded file. Common values other than the default are "application/pdf", "application/xml" or "application/msword". If , the default value is "application/octet-stream".
description  String  (Optional)
A description of the embedded file. This is presented to the user when viewing the list of embedded files. If , the default value is "".
modificationDate  NullableDateTimeOffset  (Optional)
The modify date of the file. If , the default value is modification date of the file on the file system or current time, if not available.
Exceptions
ExceptionCondition
ArgumentExceptionThe associated file stream could not be opened for reading.
ArgumentExceptionThe associate argument is invalid.
IOExceptionError reading from embeddedFile.
ArgumentNullExceptionif embeddedFile is .
ArgumentNullExceptionif name is .
See Also