I am using PDFbox
to get the font size from PDFs.
I have extended PDFTextStripper
and overridden the writeString
function which gives me access to TextPosition
object.
It works fine half the time. But the other times it returns font size as '-1'. Why is that? This affects the rest of my algorithm.
I have tried functions getHeight
, getHeightDir
and getFontSize
. I get the same results with all these.
Here is the writeString
function:
@Override
protected void writeString(String string, List<TextPosition> textPositions) throws IOException {
for (TextPosition text : textPositions) {
getChar(text);
writeString(string);
}
}
The getChar
function processes the information.
How do I fix this? Thanks in advance.
EDIT: I'm using PDFBox 2.0.2. My application requires me to convert any given file to a pdf and then process it using PDFBox. This -1 problem happens to all Spreadsheet files. I use Apache POI 3.15 to convert the document to PDF. It works fine for doc, docx, ppt, pptx, odt, odp