Page

概述

Page 是 Aspose.PDF FOSS 中用于 Python 的类。

PDF 文档的一页。

此类提供了 10 个方法,用于在 Python 程序中处理 Page 对象。可用的方法包括:__init__、accept、add_image、add_text、draw_line、draw_rectangle、redact_text、render、replace_text、save_as_image。在安装了 Aspose.PDF FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性:annotations、content、crop_box、index、media_box、rect,以及另 1 项。

属性

名称类型访问描述
indexint读写页面的零基索引。
recttuple[float, float, float, float]读取获取页面矩形(MediaBox)。
annotationsAnnotationCollection读取获取页面上的注释集合。
media_boxtuple[float, float, float, float]读取rect 的别名。
rotationint读写页面顺时针旋转的角度(0、90、180、270 之一)。
crop_boxtuple[float, float, float, float]读写页面 CropBox (x0, y0, x1, y1);未设置时回退到 MediaBox。
contentbytes读取获取页面内容流。

方法

签名描述
__init__(document: Document, index: int)Calls init(document, index) 在此 Page 实例上。
`add_text(text: str, x: float, y: float, font_size: float, font_name: strNone, font: FontDescriptor
`add_image(image: bytesbytearray
`draw_rectangle(x: float, y: float, width: float, height: float, stroke_color: Sequence[float]None, fill_color: Sequence[float]
`draw_line(x1: float, y1: float, x2: float, y2: float, stroke_color: Sequence[float], line_width: float, tag: strNone, alt: str
accept(visitor: Any)将此页面分派给实现 visit(page) 的对象。
`render(dpi: float, scale: float, background: tuple[int, int, int], antialias: boolint)→RasterizedPage`
`save_as_image(path: strPath, dpi: float, scale: float, background: tuple[int, int, int], antialias: bool
replace_text(search: str, replacement: str, case_sensitive: bool, max_count: int) → int替换此页面上简单文本显示操作数中的现有文本。
redact_text(search: str, case_sensitive: bool, max_count: int, overlay: bool, overlay_color: Sequence[float]) → int删除此页面上简单文本显示操作数中的现有文本。

另请参阅

 中文