We are excited to announce the release of Spire.PDF for Python 10.8.1. This version supports returning imageInfo[i].Image as a byte[] type. Besides, the issue that highlighting positions are inaccurate when searching and highlighting text is fixed in this update. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | SPIREPDF-6888 | Supports returning imageInfo[i].Image as a byte[] type.
byteResult = imageInfo[i].Image.ToArray()
fileName = outputFile_1 + "Bug_6888_{0:d}.png".format(i)
with open(fileName,'wb') as f:
f.write(byteResult)
|
| New feature | SPIREPDF-6902 | Synchronizes the PdfTextReplaceOptions class.
pdf=PdfDocument()
pdf.LoadFromFile(inputFile)
page = pdf.Pages[0]
textreplacer = PdfTextReplacer(page)
options = PdfTextReplaceOptions()
options.ReplaceType = ReplaceActionType.WholeWord
textreplacer.Options = options
textreplacer.ReplaceAllText("text", "text")
pdf.SaveToFile(outputFile)
|
| New feature | SPIREPDF-6903 | Synchronizes the TextStates property with the PdfTextFragment interface.
pdf = PdfDocument()
pdf.LoadFromFile(inputFile)
inder = PdfTextFinder(pdf.Pages[0])
fragments = finder.Find("PDF")
sb = []
for fragment in fragments:
sb.append(fragment.TextStates[0].FontName)
sb.append(fragment.TextStates[0].FontFamily)
sb.append(str(round(fragment.TextStates[0].FontSize,2)))
File.AppendAllText(outputFile,sb)
pdf.Close()
|
| New feature | SPIREPDF-6944 | Supports digital signature functionality.
# Load a Pdf document from disk
doc = PdfDocument()
doc.LoadFromFile(inputFile)
# Create a signature maker with the PDF document and PFX file
signatureMaker = PdfOrdinarySignatureMaker(doc, inputFile_pfx, "e-iceblue")
# Configure the signature properties
signature = signatureMaker.Signature
signature.Name = "Gary"
signature.ContactInfo = "028-81705109"
signature.Location = "Chengdu"
signature.Reason = "The certificate of this document"
# Create a signature appearance
appearance = PdfSignatureAppearance(signature)
appearance.NameLabel = "Signer: "
appearance.ContactInfoLabel = "ContactInfo: "
appearance.LocationLabel = "Location: "
appearance.ReasonLabel = "Reaseon: "
appearance.SignatureImage = PdfImage.FromFile(inputImage)
appearance.GraphicMode = GraphicMode.SignImageAndSignDetail
appearance.SignImageLayout = SignImageLayout.none
# Apply the signature to the PDF document
signatureMaker.MakeSignature("Signer:", doc.Pages.get_Item(0), 90.0, 550.0, 270.0, 90.0, appearance)
# Save the document
doc.SaveToFile(outputFile)
|
| Bug | SPIREPDF-6877 | Fixes the issue that highlighting positions are inaccurate when searching and highlighting text. |
Click the link below to get Spire.PDF for Python 10.8.1: