pdftools_toolbox.pdf.content.paint
Classes
|
- class pdftools_toolbox.pdf.content.paint.Paint(handle)[source]
Bases:
_NativeObject
- static create(target_document: Document, color_space: ColorSpace, color: List[float], transparency: Transparency | None) Paint [source]
Create an new paint.
Transparency is supported by PDF 1.4 or higher and by PDF/A-2 or higher. The returned paint object is not yet used on any page, but it is associated with the given target document.
- Parameters:
targetDocument (pdftools_toolbox.pdf.document.Document) – the output document with which the returned object is associated
colorSpace (pdftools_toolbox.pdf.content.color_space.ColorSpace) – the color space of the paint
color (List[float]) – the color components
transparency (Optional[pdftools_toolbox.pdf.content.transparency.Transparency]) – the transparency parameters. Use None to create an opaque paint.
- Returns:
newly created paint object
- Return type:
- Raises:
pdftools_toolbox.conformance_error.ConformanceError – if the transparency argument is not None and
pdftools_toolbox.pdf.content.transparency.Transparency.alpha
of transparency is not 1.0 and the explicitly specified conformance does not support transparency (PDF/A-1, PDF 1.0 - 1.3).pdftools_toolbox.conformance_error.ConformanceError – if the transparency argument is not None and
pdftools_toolbox.pdf.content.transparency.Transparency.blend_mode
is notpdftools_toolbox.pdf.content.blend_mode.BlendMode.NORMAL
and the explicitly specified conformance does not support transparency (PDF/A-1, PDF 1.0 - 1.3).ValueError – if the targetDocument argument has already been closed
ValueError – if the targetDocument argument is read-only
ValueError – if the colorSpace object has already been closed
ValueError – if the colorSpace is associated with a different document
ValueError – if the color argument contains too few elements
ValueError – if an element of the color argument is out of range
- property color_space: ColorSpace
The color space of this paint.
- Returns:
pdftools_toolbox.pdf.content.color_space.ColorSpace
- Raises:
StateError – the object has already been closed
StateError – the object has been created with any creation method of the document.
- property color: List[float]
The color values of this paint.
- Returns:
List[float]
- Raises:
StateError – the object has already been closed
StateError – the object has been created with any creation method of the document.
- property transparency: Transparency | None
The transparency parameters of this paint or None if this paint is opaque.
- Returns:
Optional[pdftools_toolbox.pdf.content.transparency.Transparency]
- Raises:
StateError – the object has already been closed
StateError – the object has been created with any creation method of the document.