Reputation: 125
I am using PDFBox API 2.0.1 version for reading PDF files. I want to extract the text properties and written the following code to get the bold property of text
@Override
protected void processTextPositon(TextPosition text)
{
System.out.println(text.getFont().getFontDescriptor().getFontWeight());
}
From the above code, I am getting 0.0 for every character even-though the character is in bold. Please suggest solution. Thanks in advance.
Upvotes: 1
Views: 1150
Reputation: 512
usingFontDescriptor.getFontWeight()
There is no guarantee of determining that whether the text is of bold or not.
I prefer you to use text.getFont().getBaseFont().Contains("bold")
for extracting Bold text .
Upvotes: 2