Agregar anotaciones emergentes
Contents
[
Hide
]
Las anotaciones emergentes son útiles para agregar comentarios, explicaciones o notas interactivas en archivos PDF. Usando PdfContentEditor, puedes crear anotaciones emergentes programáticamente especificando la ubicación, el contenido, la visibilidad y el número de página.
- Crea el objeto PdfContentEditor.
- Vincular el PDF de entrada.
- Define el rectángulo de la anotación Popup.
- Añade la anotación Popup.
- Guardar el documento actualizado.
import aspose.pdf as ap
import aspose.pdf.facades as pdf_facades
import aspose.pydrawing as apd
import sys
from os import path
sys.path.append(path.join(path.dirname(__file__), ".."))
from config import set_license, initialize_data_dir
def add_popup_annotation(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
# Add popup annotation to page 1
content_editor.create_popup(
apd.Rectangle(220, 520, 180, 80),
"This is a popup annotation",
True,
1,
)
# Save updated document
content_editor.save(outfile)