Click or drag to resize
Pdftools logo

FileAttachmentCreate Method

Create a file attachment annotation.

The returned file attachment annotation is not yet part of any page. It can be added to a page's list of annotations.

Namespace: PdfTools.Toolbox.Pdf.Annotations
Assembly: PdfTools.Toolbox (in PdfTools.Toolbox.dll) Version: 1.4.0+02318d3e3f9645a1305b87026fb971a660079e54
Syntax
C#
public static FileAttachment Create(
	Document targetDocument,
	Point topLeft,
	FileReference attachedFile,
	Paint paint
)

Parameters

targetDocument  Document
The output document with which the returned object is associated
topLeft  Point
The location of the annotation's upper left corner on the page.
attachedFile  FileReference
The file to be attached.
paint  Paint
This paint for the file attachment icon.

Return Value

FileAttachment
The newly created file attachment annotation.
Exceptions
ExceptionCondition
ArgumentExceptionif the targetDocument has already been closed
ArgumentExceptionif the targetDocument is read-only
ArgumentExceptionif the color space of the paint argument is not a device color space
ArgumentExceptionif the paint has a non-Transparency with BlendMode other than Normal
ArgumentExceptionif the paint argument is not associated with the targetDocument
ArgumentExceptionif the attachedFile argument is not associated with the targetDocument
ExistsExceptionif the attachedFile argument is already used as a plain embedded file, an associated file, or in a file attachment.
ArgumentNullExceptionif targetDocument is .
ArgumentNullExceptionif attachedFile is .
ArgumentNullExceptionif paint is .
See Also