You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Prakash Dubey <pr...@gmail.com> on 2015/08/10 18:24:39 UTC

Change the color of particular text in PDF

Hi All,
We have requirement to identify certain word (token) and change it's color
using pdfbox in pdf document.
Could anybody help me with this, Any hint?
Thanks in advance.

Re: Change the color of particular text in PDF

Posted by John Hewson <jo...@jahewson.com>.
This is actually quite tricky. You’ll need to parse the page content stream and find all of the text drawing operators and then identify the strings which you’re interested in, split them into substrings and add the color changing operators for those specific words.

PDFStreamParser can do the content stream parsing but the rest is up to you I’m afraid.

— John

> On 10 Aug 2015, at 09:24, Prakash Dubey <pr...@gmail.com> wrote:
> 
> Hi All,
> We have requirement to identify certain word (token) and change it's color
> using pdfbox in pdf document.
> Could anybody help me with this, Any hint?
> Thanks in advance.