We're pleased to announce the release of Spire.PDF for Java 12.6.4. This version adds support for setting PDF reading direction and language, and enables more flexible formatting for PDF signature operations. Moreover, it also fixes two bugs affecting signature verification and image rendering. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New Feature | SPIREPDF-7990 | Added support for setting PDF reading direction and language.
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(inputFile);
pdf.getViewerPreferences().setReadingDirection(PdfReadingDirection.LeftToRight);
pdf.setLanguage("zh-CN");
pdf.saveToFile(outputFile , FileFormat.PDF);
|
| New Feature | SPIREPDF-8091 | Added an overload of IPdfSignatureFormatter to PdfMDPSignatureMaker, providing more flexible formatting support for PDF signature operations.
PdfDocument document = new PdfDocument();
PdfPageBase pdfPageBase = document.getPages().add();
pdfPageBase.getCanvas().drawString("Hello, World!",
new PdfFont(PdfFontFamily.Helvetica, 30f),
PdfBrushes.getBlack(), 10, 10);
PdfCertificate certificate = new PdfCertificate(path+"gary.pfx", "e-iceblue");
PdfPKCS7Formatter formatter = new PdfPKCS7Formatter(certificate, false);
String timeStampUrl = "https://rfc3161.ai.moda/adobe";
formatter.setTimestampService(new TSAHttpService(timeStampUrl));
formatter.setOCSPService(new OCSPHttpService(null));
PdfMDPSignatureMaker signatureMaker = new PdfMDPSignatureMaker (document, formatter, PdfMDPSignatureMaker.Level2Permissions);
signatureMaker.makeSignature("signName");
com.spire.pdf.interactive.digitalsignatures.PdfSignature signature = signatureMaker.getSignature();
signature.setName("Gary");
// signature.setReason("This is the final version.");
signature.setLocation("U.S.");
signature.setContactInfo("112554");
PdfSignatureAppearance appearance = new PdfSignatureAppearance(signature);
appearance.setNameLabel("Signer: ");
// appearance.setReasonLabel("Reason: ");
appearance.setLocationLabel("Location: ");
appearance.setContactInfoLabel("Phone: ");
PdfImage image = PdfImage.fromFile(path+"logo.png");
appearance.setSignatureImage(image);
appearance.setGraphicMode(GraphicMode.SignImageAndSignDetail);
Rectangle2D rect = new Rectangle2D.Float();
rect.setFrame(new Point2D.Float(90, 550), new Dimension(150, 80));
signatureMaker.makeSignature("Signature", pdfPageBase,
(float) rect.getMinX(), (float) rect.getMinY(),
(float) rect.getWidth(), (float) rect.getHeight(),
appearance);
String output = "signature.pdf";
document.saveToFile(path+output, FileFormat.PDF);
document.close();
|
| Bug Fix | SPIREPDF-5475 | Fixed an issue where signature validity verification was inaccurate. |
| Bug Fix | SPIREPDF-8086 | Fixed an issue where images were rendered incorrectly. |
Click the link below to download Spire.PDF for Java 12.6.4: