Pindahkan Stempel Berdasarkan ID
Contents
[
Hide
]
Setelah menambahkan anotasi stempel karet ke PDF, Anda mungkin perlu menyesuaikan posisinya. Metode ‘move_stamp_by_id()’ memungkinkan Anda memindahkan stempel berdasarkan pengidentifikasinya, tanpa membuatnya ulang. Ini berguna dalam alur kerja otomatis di mana penempatan stempel harus disesuaikan secara dinamis.
- Buat sebuah PdfContentEditor instance.
- Hubungkan dokumen PDF input.
- Tambahkan anotasi stempel karet.
- Pindahkan stempel menggunakan ID-nya.
- Simpan dokumen PDF yang diperbarui.
import aspose.pdf.facades as pdf_facades
import aspose.pydrawing as apd
from io import BytesIO
import sys
from os import path
sys.path.append(path.join(path.dirname(__file__), ".."))
from config import set_license, initialize_data_dir
def move_stamp_by_id_example(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
content_editor.create_rubber_stamp(
1,
apd.Rectangle(300, 420, 180, 60),
"Approved",
"Move this stamp by ID",
apd.Color.green,
)
# Move stamp by ID overload
content_editor.move_stamp_by_id(1, 1, 240, 360)
# Save updated document
content_editor.save(outfile)