pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hesham Gneady" <heshamgne...@gmail.com>
Subject PDFBox gets wrong font color values from PDF file!
Date Mon, 07 Jan 2019 09:22:05 GMT
Hello,

 

In this sample PDF file:

https://www.dropbox.com/s/2z5b3vrvnzjo0lo/Font%20color%20Sample.pdf?dl=0

I am trying to check the font colors for all letters, but I have noticed
that PDFBox gets colors with values partially different from the ones that I
see in Adobe Acrobat. I use this code:

    @Override

    public void processTextPosition( TextPosition t )  {

      try {

             PDGraphicsState gs = getGraphicsState();

Color color = new Color( gs.getNonStrokingColor().toRGB() );

System.out.println( color.getRed() );

System.out.println( color.getGreen() );

System.out.println( color.getBlue() );        

      } 

       catch (IOException ioe) {}

    }

 

For example PDFBox prints the values: 

Red:64, Green:96, Blue:172

 

While in Adobe Acrobat the values appear as:

Red:66, Green:105, Blue:178

 

Is there a reason for this?

 

Best regards,

Hesham 

 

 



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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