You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Joel Hirsh <jo...@gmail.com> on 2018/03/15 05:45:38 UTC
Reading color of stroked lines
I am extending PDFGraphicsStreamEngine
and reading stroked lines. That works fine.
I am also trying to get the color of the lines with code like
@Override
public void lineTo(float x, float y) throws IOException
{
PDGraphicsState gs = super.getGraphicsState();
int rgb = gs.getStrokingColorSpace().getInitialColor().toRGB();
or
int rgb = gs.getStrokingColor().toRGB();
}
rgb is always zero, and if I breakpoint and look at the PDGraphicsState
structure it seems to have an infinite loop of pointers to ColorSpaces and
InitialColors.
Is there a way to read the stroke color?
What I am trying to do is ignore white on white lines.
Thanks
Re: Reading color of stroked lines
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 15.03.2018 um 06:45 schrieb Joel Hirsh:
> I am extending PDFGraphicsStreamEngine
>
> and reading stroked lines. That works fine.
>
> I am also trying to get the color of the lines with code like
>
> @Override
> public void lineTo(float x, float y) throws IOException
> {
>
> PDGraphicsState gs = super.getGraphicsState();
> int rgb = gs.getStrokingColorSpace().getInitialColor().toRGB();
>
> or
> int rgb = gs.getStrokingColor().toRGB();
>
> }
> rgb is always zero, and if I breakpoint and look at the PDGraphicsState
> structure it seems to have an infinite loop of pointers to ColorSpaces and
> InitialColors.
The second one should work. The best would be to share your PDF and some
minimal code. 0 = black.
Tilman
>
> Is there a way to read the stroke color?
>
> What I am trying to do is ignore white on white lines.
>
> Thanks
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org