News Category

Spire.PDF for Java 5.1.0 supports getting PDF PieceInfo dictionary information

2022-01-05 01:42:43

We are glad to announce the release of Spire.PDF for Java 5.1.0. This version supports getting PDF PieceInfo dictionary information as well as supports printing by a specified printer. Also, it enhances the conversion from PDF to Word, PDF to SVG. In addition, it fixes some known issues such as the picture of PDF file was not displayed correctly after compressing. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPDF-4782 Supports printing by a specified printer.
//Specify the printer name to print
PrintSettings setting = pdf.getPrintSettings(); setting.setPrinter("Adobe PDF");
//Getsystem default printer
PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
PrintService printer = loPrinterJob.getPrintService();
String PrinterName = printer.getName();
//set to use the current printer
loPrinterJob.setPrintService(printer);
New feature SPIREPDF-4829 Supports getting PDF PieceInfo dictionary information.
    PdfDocument pdf = new PdfDocument();
    pdf.loadFromFile(inputFile);
    StringBuilder sb = new StringBuilder();
    PdfPieceInfo info = pdf.getDocumentPieceInfo();
    ArrayList<Object> values = new ArrayList<Object>();
    HashMap<String, PdfApplicationData> dic = info.getApplicationDatas();
    for (Map.Entry<String, PdfApplicationData> item : dic.entrySet())
    {
        PdfApplicationData data = item.getValue();
        values.add(data.getPrivate());
        String content = data.getPrivate().toString();
    }
    PdfPageBase page = pdf.getPages().get(0);
    PdfPieceInfo infor2 = page.getPagePieceInfo();
    HashMap<String, PdfApplicationData> dic2 = infor2.getApplicationDatas();
    for (Map.Entry<String, PdfApplicationData> item2 : dic2.entrySet())
    {
        PdfApplicationData data2 = item2.getValue();
        if (data2.getPrivate() instanceof String) {
        String content = data2.getPrivate().toString();
    }
}
Bug SPIREPDF-4546 Optimized the the bold font was blurred after printing PDF.
Bug SPIREPDF-4788 Fixes the issue that the application threw "ArrayIndexOutOfBoundsException" when loading PDF document.
Bug SPIREPDF-4798
SPIREPDF-4799
SPIREPDF-4800
SPIREPDF-4812
Fixes the issue that the content format was incorrect when converting PDF to Word document.
Bug SPIREPDF-4816 Fixes the issue that the picture of PDF file was not displayed correctly after compressing.
Bug SPIREPDF-4817 Fixes the issue that the saved stream was incorrect when converting PDF to SVG.
Bug SPIREPDF-4841 Fixes the issue that it needed an open password when using WPS to open the PDF that only set a permission password.
Bug SPIREPDF-4842 Fixes the issue that it was unable to get the PDF used fonts.
Click the link below to download Spire.PDF for Java 5.1.0: