pdftools_toolbox.pdf.annotations.file_attachment
Classes
|
A file attachment annotation |
- class pdftools_toolbox.pdf.annotations.file_attachment.FileAttachment(handle)[source]
Bases:
MarkupAnnotation
A file attachment annotation
- static create(target_document: Document, top_left: Point, attached_file: FileReference, paint: Paint) FileAttachment [source]
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.
- Parameters:
targetDocument (pdftools_toolbox.pdf.document.Document) – The output document with which the returned object is associated
topLeft (pdftools_toolbox.geometry.real.point.Point) – The location of the annotation’s upper left corner on the page.
attachedFile (pdftools_toolbox.pdf.file_reference.FileReference) – The file to be attached.
paint (pdftools_toolbox.pdf.content.paint.Paint) – This paint for the file attachment icon.
- Returns:
The newly created file attachment annotation.
- Return type:
pdftools_toolbox.pdf.annotations.file_attachment.FileAttachment
- Raises:
ValueError – if the targetDocument has already been closed
ValueError – if the targetDocument is read-only
ValueError – if the color space of the paint argument is not a device color space
ValueError – if the paint has a non-None
pdftools_toolbox.pdf.content.paint.Paint.transparency
withpdftools_toolbox.pdf.content.transparency.Transparency.blend_mode
other thanpdftools_toolbox.pdf.content.blend_mode.BlendMode.NORMAL
ValueError – if the paint argument is not associated with the targetDocument
ValueError – if the attachedFile argument is not associated with the targetDocument
pdftools_toolbox.exists_error.ExistsError – if the attachedFile argument is already used as a plain embedded file, an associated file, or in a file attachment.
- property icon: FileAttachmentIcon
The displayed icon
- Returns:
pdftools_toolbox.pdf.annotations.file_attachment_icon.FileAttachmentIcon
- Raises:
StateError – if the object has already been closed
pdftools_toolbox.corrupt_error.CorruptError – the document is corrupt and the file reference cannot be read
- property paint: Paint
The paint for the icon and the popup
- Returns:
pdftools_toolbox.pdf.content.paint.Paint
- Raises:
StateError – if the object has already been closed
pdftools_toolbox.corrupt_error.CorruptError – if the PDF is corrupt and the annotation’s paint cannot be read
- property attached_file: FileReference
The embedded file
- Returns:
pdftools_toolbox.pdf.file_reference.FileReference
- Raises:
StateError – if the object has already been closed
- property popup: Popup | None
The pop-up
- Returns:
Optional[pdftools_toolbox.pdf.annotations.popup.Popup]
- Raises:
StateError – if the object has already been closed