mirror of
https://gitee.com/open-loongarch/buildroot-2024.08.git
synced 2026-10-28 14:07:12 +08:00
first commit: base 2024.08
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import fitz_old as fitz
|
||||
|
||||
# Write a test PDF file
|
||||
outfile = "python-pymupdf.pdf"
|
||||
sample_text = "This is a test page for python-pymupdf."
|
||||
doc = fitz.open()
|
||||
page = doc.new_page()
|
||||
p = fitz.Point(50, 72)
|
||||
page.insert_text(p, sample_text)
|
||||
doc.save(outfile)
|
||||
|
||||
# Read back the file
|
||||
with fitz.open(outfile) as d: # open document
|
||||
read_text = chr(12).join([page.get_text() for page in d])
|
||||
|
||||
print(read_text)
|
||||
assert(read_text == sample_text + "\n")
|
||||
Reference in New Issue
Block a user