We are excited to announce the release of Spire.Office for Java 11.6.0. In this version, Spire.Doc for Java enhances the conversion from Word to PDF; Spire.XLS for Java enhances Excel to PDF and image conversion; Spire.PDF for Java supports setting PDF reading direction and language. Besides, many issues have been successfully fixed in this version. More details are listed below.
Click the link to download Spire.Office for Java 11.6.0:
Here is a list of changes made in this release
Spire.Doc for Java
| Category | ID | Description |
| Bug Fix | SPIREDOC-11785 | Fixed an issue where symbols wrapped incorrectly when converting Word to PDF. |
| Bug Fix | SPIREDOC-11908 | Fixed an issue where cross-reference fields were updated incorrectly. |
| Bug Fix | SPIREDOC-11920 | Fixed an issue where text positions were incorrect when converting Word to PDF. |
| Bug Fix | SPIREDOC-11947 | Fixed an issue where bullet styles were incorrect when converting Word to PDF. |
Spire.XLS for Java
| Category | ID | Description |
| Bug Fix | SPIREXLS-6137 | Fixed the issue of incorrect pagination when converting Excel to PDF. |
| Bug Fix | SPIREXLS-6147 | Fixed the issue of the application hanging when converting a worksheet to an image. |
| Bug Fix | SPIREXLS-6156 | Fixed the issue of content being cropped when converting Excel to images. |
Spire.PDF for Java
| Category | ID | Description |
| New Feature | SPIREPDF-7829 | Added support for signing with SHA-256/SHA-512 algorithm certificates.
public static void main(String[] args) throws IOException {
// Create pdf document
PdfDocument doc = new PdfDocument();
// Load file from disk
doc.loadFromFile("Sample.docx");
// Load the X509 certificate for signature
PdfPKCS7Formatter formatter = new PdfPKCS7Formatter(new PdfCertificate("gary.pfx", "e-iceblue"), false);
// Create an instance of PdfOrdinarySignatureMaker using the loaded document and certificate
PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(doc, formatter);
// Create an instance of PdfCustomSignatureAppearance as the appearance for the signature
IPdfSignatureAppearance signatureAppearance = new PdfCustomSignatureAppearance();
// Make the signature with a specified name and the custom appearance
signatureMaker.makeSignature("Signature", signatureAppearance);
// Iterate through all hash algorithm types
for (HashAlgorithmType hashAlg : HashAlgorithmType.values()) {
// Skip SM3 (case-insensitive)
if ("SM3".equalsIgnoreCase(hashAlg.name())) {
continue;
}
try {
// Set the current hash algorithm
formatter.getProperties().setHashAlgorithm(hashAlg);
String filePath = "AddImageSignature_" + hashAlg.name() + ".pdf";
doc.saveToFile(filePath, FileFormat.PDF);
System.out.println("Succeed:" + hashAlg.name());
} catch (Exception ex) {
System.out.println("Error HashAlgorithmType:" + hashAlg.name());
System.out.println("Error Info:" + ex.getMessage());
}
}
// Close the document
doc.close();
}
// Custom signature appearance implementation
public static class PdfCustomSignatureAppearance implements IPdfSignatureAppearance {
@Override
public void generate(PdfCanvas pdfCanvas) {
// Set font size
int fontSize = 10;
// Create Arial font
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", Font.PLAIN, fontSize), true);
// Set line height
float lineHeight = fontSize;
// Draw text string
pdfCanvas.drawString("AAAAAAAAAAA", font, PdfBrushes.getRed(), new Point.Float(0, 0));
// Draw image at specified position
pdfCanvas.drawImage(PdfImage.fromFile("E-iceblue logo.png"), new Point.Float(20, 0));
}
}
|
| New Feature | SPIREPDF-8077 | Added support for setting a fallback font when converting OFD to PDF.
OfdConverter converter = new OfdConverter(ofdFile.getAbsolutePath()); converter.getOptions().setDefaultFontName(fontName); converter.toPdf(PdfPath); |
| New Feature | SPIREPDF-8078 | Added a progress callback for OFD to PDF conversion.
CustomProgressNotifier progressNotifier =new CustomProgressNotifier(output_txt);
ofdConverter ofdconverter=new Ofdconverter(inputPath);
ofdconverter.registerProgressNotifier(progressNotifier);
ofdConverter.toPdf(outputPath);
CustomProgressNotifier progressNotifier2=new CustomProgressNotifier(output_txt2);
PdfToWordConverter converter=new PdfTowordConverter(inputPath2);
converter.registerProgressNotifier(progressNotifier2);
converter.saveToDocx(outputPath2)
|
| 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-8040 | Fixed the issue where loading a PDF without a permission password caused an exception. |
| Bug Fix | SPIREPDF-8060 | Fixed the issue where converting an image to PDF caused an exception. |
| Bug Fix | SPIREPDF-8065 | Fixed the issue where checkmarks were missing when converting PDF to PDFA. |
| Bug Fix | SPIREPDF-8067 | Fixed the issue where extracted PDF text contained garbled characters. |
| Bug Fix | SPIREPDF-8079 | Fixed the issue where PDF-to-SVG conversion displayed incorrect content in browsers. |
| 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. |