pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hesham Gneady" <heshamgne...@gmail.com>
Subject Extract bold text from a PDF file
Date Mon, 18 Mar 2019 10:13:21 GMT
Hello ,


I am trying to extract the bold text for some PDF files, but some fail like
this one:



I am overriding the processTextPosition (.) method to do this, and i have
tried all these options, but none has worked for me:

1.	if(
"bold" ) ) {.}  // returns false.
2.	if( text.getFont().getName().toLowerCase().contains( "bold" )  {.}
// returns false.
3.	System.out.println(
text.getFont().getFontDescriptor().getFontWeight() );  // returns 0.0.
4.	System.out.println( getGraphicsState().getLineWidth() );  // returns
5.	System.out.println(
getGraphicsState().getTextState().getRenderingMode() );  // returns FILL


Note: The font name for the bold text in the PDF file is
"frutigernextlt-heavycn". It has the word "heavy". I could detect it this
way, but I think this is not a right procedure, as I have other PDF files
with font names that have the "heavy" word while they're not bold.


Best regards,






This email has been checked for viruses by Avast antivirus software.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message