Spire.PDF for Java 9.10.3 supports configuring AES encryption algorithms and setting the names of existing fields

Spire.PDF for Java 9.10.3 supports configuring AES encryption algorithms and setting the names of existing fields

2023-10-18 06:59:44

We are delighted to announce the release of Spire.PDF for Java 9.10.3. This version supports configuring AES encryption algorithms and setting the names of existing fields. Besides, it also enhances the conversion from PDF to SVG, PPTX, and PDFA2B as well as OFD to PDF. In addition, some known issues are fixed successfully in this version, such as the issue that the application threw the "NullPointerException" when loading PDF documents. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature - Synchronizes the new encryption and decryption interface to Java, and supports configuring the AES encryption algorithm.
PdfEncryptionAlgorithm.AES
//Create password security policies
PdfSecurityPolicy securityPolicy = new PdfPasswordSecurityPolicy("", "123456"); 
//Set AES encryption algorithm
securityPolicy.setEncryptionAlgorithm( PdfEncryptionAlgorithm.AES_256); 
//Set document permissions (ownership), default is ForbidAll.
securityPolicy.setDocumentPrivilege(PdfDocumentPrivilege.getForbidAll());
securityPolicy.getDocumentPrivilege().setAllowDegradedPrinting(true);
securityPolicy.getDocumentPrivilege().setAllowModifyAnnotations(true);
securityPolicy.getDocumentPrivilege().setAllowAssembly(true);
securityPolicy.getDocumentPrivilege().setAllowModifyContents(true);
securityPolicy.getDocumentPrivilege().setAllowFillFormFields(true);
securityPolicy.getDocumentPrivilege().setAllowPrint(true);
pdf.encrypt(securityPolicy);
PdfDocument pdf = new PdfDocument();
//Pass the open password to open the PDF document
pdf.loadFromFile(inputFile, "1234"); 
//Decrypt
pdf.decrypt();
pdf.saveToFile(outputFile, FileFormat.PDF);
pdf.dispose();
New feature SPIREPDF-6306 Supports setting the names of existing fields.
PdfDocument document=new PdfDocument();
document.loadFromFile("input.pdf");
PdfFormWidget formWidget = (PdfFormWidget)document.getForm();
for (int i = 0; i < formWidget.getFieldsWidget().getCount(); i++)
{
    PdfField field = (PdfField)formWidget.getFieldsWidget().get(i);
    for (PdfFieldWidget widget : (Iterable<? extends PdfFieldWidget>) formWidget.getFieldsWidget())
    {
        if (widget.getName() == "oldName")
        {
            widget.setName("NewName");
        }
    }
}
document.saveToFile("result.pdf",FileFormat.PDF);
Bug SPIREPDF-6253
SPIREPDF-6313
Fixes the issue that the background was incorrect after converting PDF to SVG.
Bug SPIREPDF-6275 Fixes the issue that the shape color was incorrect and the content was missing after converting PDF to PPTX.
Bug SPIREPDF-6277 Fixes the issue that images were obstructed after converting PDF to PPTX.
Bug SPIREPDF-6300 Fixes the issue that the standard validation failed after converting PDF to PDFA2B.
Bug SPIREPDF-6307 Fixes the issue that stamps were lost after converting OFD to PDF.
Bug SPIREPDF-6324 Fixes the issue that the program threw "NullPointerException" when loading PDF.
Click the link below to download Spire.PDF for Java 9.10.3: