Question
How to check the font of the extracted text?
Answer
Here is a C++ code snippet which can be used to extract fonts:
for(int k = 0; k < paragraphs.getCount(); k++) {
IParagraph paragraph = paragraphs.getElement(k);
IFontStyle baseFont = paragraph.getParagraphStyle().getBaseFont();
System.out.println("Font Name: " + baseFont.getFontName());
System.out.println("Font Type: " + baseFont.getFontType().name());
System.out.println("Font Size: " + baseFont.getFontSize());
System.out.println("Text: " + paragraph.getText());
}
In order to detect fonts properly, make sure that the related fonts are installed in your system.
If the fonts are already installed/registered in your system but the fonts are still can't be detected correctly, then you will need to specify the path to the fonts folder using the CustomFontSet::setFolder("path to your fonts folder") property.
Comments
0 comments
Please sign in to leave a comment.