Spire.PDF for Python 11.7.0 supports removing PdfWatermarkAnnotationWidget objects

Spire.PDF for Python 11.7.0 supports removing PdfWatermarkAnnotationWidget objects

2025-07-11 06:54:35

We're pleased to announce the release of Spire.PDF for Python 11.7.0. This version supports removing PdfWatermarkAnnotationWidget objects, and also fixes two issues that occurred when converting OFD to PDF and retrieving PDF font properties. More details are listed below.

Here is a list of all changes made in this release

Category ID Description
Optimization - Optimizes and modularizes the namespace structures.
New feature SPIREPDF-7230 Supports removing PdfWatermarkAnnotationWidget objects.
# Create a PdfDocument object
pdfDocument = PdfDocument()

# Load PDF document from file
pdfDocument.LoadFromFile(inputFile_add)

# Define watermark text
id = "NO_01"

# Iterate through the pages in the document
for i in range(pdfDocument.Pages.Count):
    # Get all annotations on the current page
    annotationWidget = pdfDocument.Pages[i].Annotations
    # Iterate backwards through annotations (to allow safe removal)
    for j in range(len(annotationWidget)-1, -1, -1):
        if isinstance(annotationWidget[j], PdfWatermarkAnnotationWidget):
            if annotationWidget[j].Text == id:
                # Remove the matching watermark annotation
                annotationWidget.Remove(annotationWidget[j])

# Save the modified PDF document to a new file
pdfDocument.SaveToFile(outputFile_del)

# Release resources of the PdfDocument object
pdfDocument.Dispose()
New feature SPIREPDF-7274 Supports inserting PdfSignatureField.
from spire.pdf import *

# Create a PDF document
doc = PdfDocument()
page = doc.Pages.Add()
signatureField=PdfSignatureField(page,"mysignaturefield")
signatureField.Bounds=RectangleF(20.0,50.0,100.0,100.0)
signatureField.HighlightMode=PdfHighlightMode.Outline
signatureField.ToolTip="signature"
doc.Form.Fields.Add(signatureField)
doc.Form.NeedAppearances=True

doc.SaveToFile("CreateField.pdf")
Bug SPIREPDF-7123 Fixes the "Arg_NullReferenceException" error occurred when converting OFD to PDF.
Bug SPIREPDF-7273 Fixes an error occurred when retrieving PDF font properties.
Click the link to download Spire.PDF for Python 11.7.0: