Page
Page
ภาพรวม
Page เป็นคลาสใน Aspose.PDF FOSS สำหรับ Python.
หน้าหนึ่งของเอกสาร PDF.
คลาสนี้ให้ 10 เมธอดสำหรับทำงานกับอ็อบเจ็กต์ Page ในโปรแกรม Python. เมธอดที่มีให้รวมถึง: __init__, accept, add_image, add_text, draw_line, draw_rectangle, redact_text, render, replace_text, save_as_image. สมาชิกสาธารณะทั้งหมดสามารถเข้าถึงได้จากแอปพลิเคชัน Python ใด ๆ หลังจากติดตั้งแพ็กเกจ Aspose.PDF FOSS สำหรับ Python. คุณสมบัติ: annotations, content, crop_box, index, media_box, rect, และอีก 1 รายการ.
คุณสมบัติ
| ชื่อ | ประเภท | การเข้าถึง | คำอธิบาย |
|---|---|---|---|
index | int | อ่าน/เขียน | ดัชนีที่เริ่มจากศูนย์ของหน้า. |
rect | tuple[float, float, float, float] | อ่าน | รับสี่เหลี่ยมของหน้า (MediaBox). |
annotations | AnnotationCollection | อ่าน | รับคอลเลกชันของคำอธิบายบนหน้า. |
media_box | tuple[float, float, float, float] | อ่าน | นามแฝงสำหรับ rect. |
rotation | int | อ่าน/เขียน | การหมุนของหน้าเป็นองศา ตามเข็มนาฬิกา (หนึ่งใน 0, 90, 180, 270). |
crop_box | tuple[float, float, float, float] | อ่าน/เขียน | หน้า CropBox (x0, y0, x1, y1); จะใช้ค่าเริ่มต้นจาก MediaBox เมื่อไม่ได้ตั้งค่า. |
content | bytes | อ่าน | รับสตรีมเนื้อหาหน้า. |
วิธีการ
| ลายเซ็น | คำอธิบาย |
|---|---|
__init__(document: Document, index: int) | Calls init(document, index) บนอินสแตนซ์ Page นี้. |
| `add_text(text: str, x: float, y: float, font_size: float, font_name: str | None, font: FontDescriptor |
| `add_image(image: bytes | bytearray |
| `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: str | None, alt: str |
accept(visitor: Any) | ส่งหน้านี้ไปยังอ็อบเจ็กต์ที่ทำการดำเนินการตาม visit(page). |
| `render(dpi: float, scale: float, background: tuple[int, int, int], antialias: bool | int)→RasterizedPage` |
| `save_as_image(path: str | Path, 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 | ลบข้อความที่มีอยู่จากตัวดำเนินการแสดงข้อความแบบง่ายบนหน้านี้. |