We are excited to announce the release of Spire.Office for Java 11.5.0. In this version, Spire.PDF for Java adds support for PDF conversion progress callback; Spire.Doc for Java adds support for footnote/endnote counting and font embedding option; Spire. Presentation for Java adds support for compressing images. 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.5.0:
Here is a list of changes made in this release
Spire.Doc for Java
| Category | ID | Description |
| New Feature | SPIREDOC-11693 | Added support for retrieving the number of footnotes or endnotes.
Document doc = new Document();
doc.loadFromFile(inputFile);
StringBuilder sb = new StringBuilder();
for (int n = 0; n < doc.getSections().getCount(); n++) {
Section s = doc.getSections().get(n);
for (int i = 0; i < s.getParagraphs().getCount(); i++) {
Paragraph para = s.getParagraphs().get(i);
for (int j = 0, cnt = para.getChildObjects().getCount(); j < cnt; j++) {
ParagraphBase pBase = (ParagraphBase) para.getChildObjects().get(j);
if (pBase instanceof Footnote) {
Footnote fn = (Footnote) pBase;
if (fn.getFootnoteType() == FootnoteType.Footnote) {
StringBuilder fnText = new StringBuilder();
for (int k = 0; k < fn.getTextBody().getParagraphs().getCount(); k++) {
fnText.append(fn.getTextBody().getParagraphs().get(k).getText());
}
sb.append("Footnote:"+ fnText.toString() + "\nFootnoteID:" + fn.getId() + "\n");
}
if (fn.getFootnoteType() == FootnoteType.Endnote) {
StringBuilder enText = new StringBuilder();
for (int k = 0; k < fn.getTextBody().getParagraphs().getCount(); k++) {
enText.append(fn.getTextBody().getParagraphs().get(k).getText());
}
sb.append("Endnote:"+ enText.toString() + "\nEndnoteID:" + fn.getId() + "\n");
}
}
}
}
}
|
| New Feature | SPIREDOC-11878 | Added support for the “Embed only characters used in the document” setting.
doc.setEmbedFontsInFile(true); doc.setSaveSubsetFonts(true); |
| Bug Fix | SPIREDOC-11829 | Fixed an issue with inconsistent formatting when converting Word to PDF. |
| Bug Fix | SPIREDOC-11899 | Fixed an issue with blurry images when converting Word to PDF. |
Spire.PDF for Java
| Category | ID | Description |
| New Feature | SPIREPDF-8044 | Added support for progress callback when converting PDF documents.
class CustomProgressNotifier implements IProgressNotifier {
StringBuilder str = new StringBuilder();
private String outputFile;
public CustomProgressNotifier(String outputFile) {
this.outputFile = outputFile;
}
@Override
public void notify(float progress) {
str.append("==============Progress: ").append(progress).append("%==============\n");
try {
Files.writeString(Paths.get(outputFile), str.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
//using
PdfDocument pdf=new PdfDocument();
pdf.loadFromFile("test.pdf");
pdf.registerProgressNotifier(new CustomProgressNotifier("Progress.txt"));
pdf.saveToFile("out.docx", FileFormat.DOCX);
pdf.dispose();
|
| Bug Fix | SPIREPDF-7642 | Fixed issue with content inconsistency when converting SVG to PDF. |
| Bug Fix | SPIREPDF-7683 | Fixed issue with incorrect validation results of digital signatures. |
Spire.Presentation for Java
| Category | ID | Description |
| New Feature | SPIREPPT-3082 | Added support for compressing images.
Presentation presentation = new Presentation();
presentation.loadFromFile(inputFile);
SlideCollection slides = presentation.getSlides();
for (int i = 0; i < slides.getCount(); i++) {
ISlide slide = slides.get(i);
ShapeCollection shapes = slide.getShapes();
for (int j = 0; j < shapes.getCount(); j++) {
IShape shape = shapes.get(j);
if (shape instanceof SlidePicture) {
SlidePicture slidepicture = (SlidePicture) shape;
// The smaller the value, the greater the compression
boolean result = slidepicture.getPictureFill().getCompressImage( true, 50f);
}
}
}
|
| Bug Fix | SPIREPPT-3093 | Fixed the issue where the background color was incorrect when converting PowerPoint to PDF. |