pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Change the color of particular text in PDF
Date Tue, 11 Aug 2015 16:42:22 GMT
Am 11.08.2015 um 16:23 schrieb Prakash Dubey:
> We have a requirement where we need to identify the particular text and
> change the color of text.
> Currently i'm able to identify the text and replace the value of text, but
> not getting API to change the color of text.
>
> Could you please provide any example, code snippet or hint for changing the
> color of text in PDF using PDFBox.

This depends on what color you're using... for /DeviceRGB, you could use 
setStrokingColor(r,g,b); however if you're messing with the content 
stream directly, just insert

r g b  rg

where  r g b values are between 0 and 1. So 1 0 0 RG sets red. Don't 
forget to add a linefeed or a space to separate from the rest.

However I expect your problem to be much more complex... PDF isn't 
"something like HTML", so look around for the examples in the sources 
and then come back for more help :-)


Tilman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message