Am 11.08.2015 um 19:15 schrieb Prakash Dubey:
You said you have already identified the text. I thought this means you
have looked at the content stream.
I have used following link code to identify the code :
http://www.coderanch.com/t/494267/open-source/replacing-String-PDF-PDFBox
Yes... while that code is outdated, the current example can now be found
in ReplaceString.java in the source code download.
What you could try is to insert new tokens as explained into the content
stream just before the text you want to change. Or to alter existing tokens.
You need to do some work yourself. I.e. create a new PDFOperator("rg"),
preceded by three numbers, and insert these at the correct place into
that list. Alternatively, review what tokens you get, and change the
existing ones.
PDFBox is very low level, it also helps to know a bit about PDF. Get the
PDF spec and start with "operator summary" and then click around. It is
also useful to have a look at the uncompressed PDF. Use the
"WriteDecodedDoc" command line utility and then use NOTEPAD++ to have a
look.
Tilman
On Tue, Aug 11, 2015 at 10:42 PM, Tilman Hausherr <[email protected]>
wrote:
Am 11.08.2015 um 19:01 schrieb Prakash Dubey:
Thanks for your reply Tilman.
his depends on what color you're using... for /DeviceRGB
PDF is generated through Japser.
Then generate it again, with different settings...
if you're messing with the content stream directly, just insert
r g b rg
I didn't get. Will directly messing with content stream will solve my
problem?
Maybe, maybe not. You said you have already identified the text. I thought
this means you have looked at the content stream.
Tilman
On Tue, Aug 11, 2015 at 10:12 PM, Tilman Hausherr <[email protected]>
wrote:
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: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]