We're pleased to announce the release of Spire.PDF for Java 10.4.4. This version supports getting the keyword font names and sizes, and also fixes the issue that the converted PDFA2B file did not pass validation. More details are listed below.
Here is a list of changes made in this release
Category | ID | Description |
New feature | SPIREPDF-6243 SPIREPDF-6638 |
Supports getting the keyword font names and sizes.
PdfDocument pdf = new PdfDocument(); pdf.loadFromFile(inputFile); PdfPageBase page = pdf.getPages().get(0); PdfTextFinder finds = new PdfTextFinder(page); finds.getOptions().setTextFindParameter(EnumSet.of(TextFindParameter.IgnoreCase)); List<PdfTextFragment> result = finds.findAllText(page); StringBuilder str = new StringBuilder(); for (PdfTextFragment find : result) { str.append("FontName:"+find.getTextStates()[0].getFontName()); str.append("FontSize:"+find.getTextStates()[0].getFontSize()); str.append("FontFamily:"+find.getTextStates()[0].getFontFamily()); str.append("Bold:"+find.getTextStates()[0].isBold()); str.append("Italic:"+find.getTextStates()[0].isItalic()); str.append("ForegroundColor:"+find.getTextStates()[0].getForegroundColor()); } |
New feature | SPIREPDF-6560 | The PdfTextReplacer class supports matching through regular expressions.
PdfDocument doc = new PdfDocument(); doc.loadFromFile("input.pdf"); PdfTextReplaceOptions textReplaceOptions = new PdfTextReplaceOptions(); textReplaceOptions.setReplaceType(EnumSet.of(ReplaceActionType.Regex)); PdfPageBase page = doc.getPages().get(0); PdfTextReplacer textReplacer = new PdfTextReplacer(page); textReplacer.setOptions(textReplaceOptions); String regularExpression = "\\bS\\w*L\\b"; textReplacer.replaceAllText(regularExpression, "NEW"); doc.saveToFile("output.pdf"); doc.dispose(); |
Bug | SPIREPDF-6330 | Fixes the issue that the converted PDFA2B file did not pass validation. |
Click the link below to download Spire.PDF for Java 10.4.4: