ShapeRenderer

Overview

ShapeRenderer is a class in Aspose.Words FOSS for Python.

Renders shapes, images, and positioned elements.

This class provides 10 methods for working with ShapeRenderer objects in Python programs. Available methods include: __init__, compress_image_bytes, estimate_text_box_height, render_anchored_wrapped_shapes, render_floating_images, render_image_shape, render_positioned_shape, render_positioned_shapes, render_positioned_shapes_in, render_shape. All exported members are accessible to any Python application after installing the Aspose.Words FOSS for Python package.

Methods

SignatureDescription
__init__(writer: PDFWriterContext)None
compress_image_bytes(image_bytes: bytes)bytesApply image_compression and jpeg_quality options to raw image bytes.
render_shape(pdf: FPDF, shape: ldm.ShapeNode)Render a ShapeNode: image first (if any), then text-box paragraphs.
render_image_shape(pdf: FPDF, shape: ldm.ShapeNode)Embed an image from a ShapeNode into the PDF, scaling to fit page width.
render_floating_images(pdf: FPDF, para: ldm.Paragraph)Draw wrapNone images at their anchor coordinates.
render_anchored_wrapped_shapes(pdf: FPDF, para: ldm.Paragraph)Draw anchored (non-inline) shapes that wrap text around them.
render_positioned_shapes(pdf: FPDF, doc: ldm.Document)Draw every absolutely-positioned shape on the current (first) page.
render_positioned_shapes_in(pdf: FPDF, paragraphs: list[ldm.Paragraph], line_y_override: Optional[float])Draw positioned shapes carried by paragraphs without moving cursor.
render_positioned_shape(pdf: FPDF, shape: ldm.ShapeNode, line_y_override: Optional[float], y_override: Optional[float])Draw a positioned shape at its absolute page coordinates.
estimate_text_box_height(paragraphs: list[ldm.Paragraph])floatApproximate the laid-out height of a list of paragraphs in mm.

See Also