Spire.PDF for Android via Java 9.7.1 supports PDF to PPTX conversion and image compression

2023-07-24 09:28:22

We are excited to announce the release of Spire.PDF for Android via Java 9.7.1. This version supports PDF to PPTX conversion and image compression. It also changes the way to get Metadata. Besides, the release also includes bug fixes. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature - Supports converting PDF to PPTX.
String input = "data/JavaPDFSample_1.pdf";
String output = "output/toPPTX.pptx";
//Load a pdf document
PdfDocument doc = new PdfDocument();
doc.loadFromFile(input);
//Convert to pptx file.
doc.saveToFile(output, FileFormat.PPTX);
doc.close();
New feature - Supports image compression.
PdfCompressor compressor = new PdfCompressor(inputFile);
compressor.getOptions().getImageCompressionOptions().setCompressImage(true);
compressor.getOptions().getImageCompressionOptions().setResizeImages(true);
compressor.getOptions().getImageCompressionOptions().setImageQuality(ImageQuality.High);
compressor.compressToFile(outputFile);
New feature - Adds a new method pdf.getDocumentInformation() to get the Metadata data, and deprecated XmpMetadata.
PdfDocument doc = new PdfDocument();
doc.loadFromFile(inputFile);
StringBuilder builder = new StringBuilder();
builder.append("Author:" + doc.getDocumentInformation().getAuthor() + "\r\n");
builder.append("Title: " + doc.getDocumentInformation().getTitle() + "\r\n");
builder.append("Creation Date: " + doc.getDocumentInformation().getCreationDate() + "\r\n");
builder.append("Subject: " + doc.getDocumentInformation().getSubject() + "\r\n");
builder.append("Producer: " + doc.getDocumentInformation().getProducer() + "\r\n");
builder.append("Creator: " + doc.getDocumentInformation().getCreator() + "\r\n");
builder.append("Keywords: " + doc.getDocumentInformation().getKeywords() + "\r\n");
builder.append("Modify Date: " + doc.getDocumentInformation().getModificationDate() + "\r\n");
builder.append("Customed Property's value: " + doc.getDocumentInformation().getCustomProperty("Field1"));
FileWriter fw = new FileWriter(new File(outputFile), true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(builder.toString());
bw.flush();
bw.close();
fw.close();
Bug - Fixes the issue that the program did not prompt an error when the open password and the permission password were the same.
Click the link below to download Spire.PDF for Android via Java 9.7.1: