Spire.PDF for Python 12.9.4 Adds Support for Multiple PDF Annotations and Code 128 Barcodes

2026-09-24 10:25:04

We're pleased to announce the release of Spire.PDF for Python 12.9.4. This version adds support for multiple PDF annotation types, including Caret, Circle, Square, FileAttachment, Movie, Screen, RichMedia, and Widget annotations, and adds support for drawing Code 128 barcodes. It also fixes several issues related to PDF attachments, text replacement, text extraction, and text positioning. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature - Added support for Caret annotations.
 rect = RectangleF(100.0, 100.0, 10.0, 15.0)
  annotation = PdfCaretAnnotation(page, rect)
  annotation.Title = "CaretTest"
  annotation.Contents = "A caret annotation with default (None) symbol."
  annotation.Color = PdfRGBColor(0, 0, 255)
  annotation.Border.Width = 1
  annotation.Intent = "ParaCaret"
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for Circle annotations.
annotation = PdfCircleAnnotation(page, rect)
  annotation.Color = PdfRGBColor(128, 0, 128)
  annotation.InteriorColor = PdfRGBColor(255, 255, 200)
  annotation.Border.Width = 2
  annotation.Border.Style = PdfBorderStyle.Solid
  annotation.Border.Effect = PdfBorderEffect.Cloudy
  annotation.Border.EffectIntensity = 2
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for Square annotations.
annotation = PdfSquareAnnotation(page, rect)
  annotation.Color = PdfRGBColor(128, 0, 128)
  annotation.InteriorColor = PdfRGBColor(255, 255, 200)
  annotation.Border.Width = 2
  annotation.Border.Style = PdfBorderStyle.Dashed
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for FileAttachment annotations.
fileSpecification = PdfFileSpecification("SalesReportChart.png", data)
  annotation = PdfFileAttachmentAnnotation(page, bounds, fileSpecification)
  annotation.Icon = PdfFileIcon.Graph
  annotation.Color = PdfRGBColor(Color.get_Teal())
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for Movie annotations.
annotation = PdfMovieAnnotation(page, rect, "sample.wmv")
  annotation.Title = "My Movie Player"
  annotation.Movie.Poster = False
  annotation.Movie.Aspect = SizeF(16.0, 9.0)
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for Screen annotations.
annotation = PdfScreenAnnotation(page, rect)
  annotation.Title = "ScreenWithBorder"
  annotation.Border.Width = 3.0
  annotation.Border.Style = PdfBorderStyle.Dashed
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for RichMedia annotations.
annotation = PdfRichMediaAnnotation(page, rect, content)
  annotation.Content = PdfRichMediaContent()
  annotation.Color = PdfRGBColor(Color.get_Green())
  PdfAnnotationCollection.Create(page).Add(annotation)
New Feature - Added support for Widget annotations.
 doc.LoadFromFile("widget.pdf")
  a = PdfAnnotationCollection.Create(page).get_Item(0)
  a.Characteristics.BackgroundColor
  a.Characteristics.BorderColor
  a.Flatten()
New Feature SPIREPDF-7101 Added support for drawing Code 128 barcodes through the PdfCode128ABarcode interface.
message = '0123456789'
Code128 = PdfCode128ABarcode(message)
Code128.BarcodeToTextGapHeight = 1.0
Code128.TextDisplayLocation = TextLocation.Bottom
Code128.TextColor = PdfRGBColor(Color.get_Blue())
Code128.Draw(page, PointF(0.0, y))
Bug Fix SPIREPDF-7291 Fixed an issue where attachments failed to open after being added to a PDF.
Bug Fix SPIREPDF-7923 Fixed an issue where text replacement failed.
Bug Fix SPIREPDF-7939 Fixed an issue where extra spaces appeared in extracted text.
Bug Fix SPIREPDF-8119 Fixed an issue where the position was incorrect after drawing text using the PdfTextWidget interface.
Click the link below to download Spire.PDF for Python 12.9.4: