Spire.PDF for Python 11.9.0 supports adding tables to PDF

Spire.PDF for Python 11.9.0 supports adding tables to PDF

2025-09-05 07:59:16

We're pleased to announce the release of Spire.PDF for Python 11.9.0. This version supports adding tables to PDF and adding annotations to multi-line text. Besides, an issue that occurred in the HTML files generated from PDFs has also been fixed. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPDF-7343 Supports adding tables in PDF.
pdf = PdfDocument()
page = pdf.Pages.Add(PdfPageSize.A3())
pen = PdfPen(PdfRGBColor(Color.get_Black()), 0.1)
#Set line border location and size
x = 5.0
y = 5.0
width = page.Size.Width - (x * 2)
height = page.Size.Height - (y * 2)


page.Canvas.DrawRectangle(pen, x, y, width, height)

# Add table
grid = PdfGrid()
row = grid.Rows.Add()
grid.Columns.Add(2)
for i in range(grid.Columns.Count):
    grid.Columns[i].Width = 50
    row.Cells[i].Value = "add{0:d}".format(i + 1)

border = PdfBorders()
border.All = PdfPen(Color.get_Gray())

for j in range(grid.Rows.Count):
    cells = grid.Rows.get_Item(j).Cells
        for k in range(cells.Count):
            cells.get_Item(k).Style.Borders = border

#Draw the grid table
grid.Draw(page, PointF(50.0, 50.0))

pdf.SaveToFile(outputFile)
pdf.Close()
New feature SPIREPDF-7501 Supports adding annotations to multi-line text.
pdf = PdfDocument()
pdf.LoadFromFile(inputFile)
page = pdf.Pages[0];

finder = PdfTextFinder(page)
finder.Options.Parameter = TextFindParameter.WholeWord
finder.Options.Parameter = TextFindParameter.IgnoreCase
fragments = finder.Find("An older meaning still in use today is that of Aristotle, for whom scientific knowledge was a body of reliable knowledge that can be logically and rationally explained.")
textFragment = fragments[0]
text = "There is a markup annotation added by Spire.PDF for .NET."
quadPoints = [None for _ in range(len(textFragment.Bounds) * 4)]
for i in range(len(textFragment.Bounds)):
    rect = textFragment.Bounds[i]
    quadPoints[4 * i] = PointF(rect.Left, rect.Top)
    quadPoints[4 * i + 1] = PointF(rect.Right, rect.Top)
    quadPoints[4 * i + 2] = PointF(rect.Left, rect.Bottom)
    quadPoints[4 * i + 3] = PointF(rect.Right, rect.Bottom)

annotation = PdfTextMarkupAnnotation(textFragment.Bounds[0], quadPoints)
annotation.Text = text
annotation.TextMarkupColor = PdfRGBColor(Color.get_Blue())
page.Annotations.Add(annotation)
pdf.SaveToFile(outputFile)
New feature SPIREPDF-7527 Supports setting DPI when converting PDF to image.
pdf.SaveAsImage(pageIndex,dpiX,dpiY)
Bug SPIREPDF-7594 Fixes an issue where HTML files generated from PDF could not be edited normally in the "jodit-react WYSIWYG" editor.
Click the link to download Spire.PDF for Python 11.9.0: