We’re pleased to announce the release of Spire.PDF for Java 12.10.0. This version adds support for setting fonts when converting HTML to PDF and introduces the setTextPen(PdfPen) method to PdfGridCellContent. It also fixes several issues related to PDF-to-Word conversion and image metadata retrieval. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New Feature | SPIREPDF-8121 | Added support for setting fonts when converting HTML to PDF.
ConvertOptions options = new ConvertOptions();
options.setAllowedFonts(new String[] { "Times New Roman", "Arial" });
converter.convertToPdf(input, output, options);
|
| New Feature | SPIREPDF-8142 | Added the setTextPen(PdfPen) method to PdfGridCellContent.
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.getPages().add();
PdfGrid grid = new PdfGrid();
grid.getStyle().setCellSpacing(1.0f);
PdfGridRow row = grid.getRows().add();
grid.getColumns().add(2);
float width = (float) page.getCanvas().getClientSize().getWidth()-(grid.getColumns().getCount() + 1);
grid.getColumns().get(0).setWidth(width * 0.8f);
PdfGridCell pdfGridCell = row.getCells().get(0);
PdfGridCellStyle pdfGridStyle =new PdfGridCellStyle();
PdfPen pen = PdfPens.getGreen();
pdfGridStyle.setTextPen(pen);
pdfGridStyle.setTextBrush(PdfBrushes.getBlack());
Font font=new Font("方正仿宋_GBK", Font.PLAIN, 12);
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(font, true);
pdfGridStyle.setFont(trueTypeFont);
pdfGridCell.setStyle(pdfGridStyle);
pdfGridCell.setValue("Thank you for interest in Spire.PDF.");
PdfGridCellContentList lst = new PdfGridCellContentList();
PdfGridCellContent textAndStyle = new PdfGridCellContent();
textAndStyle.setText("Thank you for interest in Spire.PDF.");
textAndStyle.setFont(trueTypeFont);
textAndStyle.setPen(PdfPens.Green());
textAndStyle.setBrush(PdfBrushes.getGreen());
lst.getList().add(textAndStyle);
row.getCells().get(1).setValue(lst);
PdfLayoutResult result = grid.draw(page, new Point2D.Float(10, 100));
doc.saveToFile("result_Bold.pdf", FileFormat.PDF);
|
| Bug Fix | SPIREPDF-7542 | Fixed an issue where spaces between words were lost when converting PDF to Word. |
| Bug Fix | SPIREPDF-7659 | Fixed an issue where chart data was lost when converting PDF to Word in flow layout mode. |
| Bug Fix | SPIREPDF-7955 | Fixed an issue where the conversion results were inaccurate when converting PDF to Word. |
| Bug Fix | SPIREPDF-8103 | Fixed an issue where font names had an extra prefix and bold formatting was lost when converting PDF to Word. |
| Bug Fix | SPIREPDF-8120 | Fixed an issue where formatting was incorrect when converting PDF to Word. |
| Bug Fix | SPIREPDF-8157 | Fixed an issue where a NoSuchMethodException was thrown when calling ImageReader.getImageMetadata. |
Click the link below to download Spire.PDF for Java 12.10.0: