You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Yurii Luchkiv <yu...@gmail.com> on 2016/08/29 07:02:06 UTC

PDFBox - replace text, add color to text, delete text

Hello PdfBox team.

Is there any good examples where I can check how to replace text or add
color to text or underline a text?
I found some examples like:
https://svn.apache.org/repos/asf/pdfbox/tags/1.5.0/pdfbox/src/main/java/org/apache/pdfbox/examples/pdmodel/ReplaceString.java
But as I see from Migration information "Why was the ReplaceText example
removed?" from here: https://pdfbox.apache.org/2.0/migration.html It is not
good practice. Can anybody help me with this? Thanks

BR, Yurii

Re: PDFBox - replace text, add color to text, delete text

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 29.08.2016 um 09:02 schrieb Yurii Luchkiv:
> Hello PdfBox team.
>
> Is there any good examples where I can check how to replace text or add
> color to text or underline a text?
> I found some examples like:
> https://svn.apache.org/repos/asf/pdfbox/tags/1.5.0/pdfbox/src/main/java/org/apache/pdfbox/examples/pdmodel/ReplaceString.java
> But as I see from Migration information "Why was the ReplaceText example
> removed?" from here: https://pdfbox.apache.org/2.0/migration.html It is not
> good practice. Can anybody help me with this? Thanks

The URL you mention explains why you can't easily replace text, and 
recommends to look at your file with PDFDebugger. Did you do that?

About the rest:
- add color to text: might be possible by inserting a color command into 
the content stream, if you know where.
- underline a text: you just draw a line at the correct position.

You have to understand that PDF isn't meant for editing. It isn't WORD 
or HTML. Any tool that offers to do "editing" will be very complex.

Tilman

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