You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "KrishVij (via GitHub)" <gi...@apache.org> on 2025/10/30 16:40:00 UTC
[PR] add ChangeTextColor example to modify text color in PDF documents [pdfbox]
KrishVij opened a new pull request, #303:
URL: https://github.com/apache/pdfbox/pull/303
### PDFBOX-3.6: Add ChangeTextColor example
This pull request adds a new example class **`ChangeTextColor`** to the PDFBox examples module
(`org.apache.pdfbox.examples.pdmodel`).
The example demonstrates how to modify the **text color** in an existing PDF by parsing its content streams,
identifying text sections, and injecting RGB color operators (`rg` and `RG`) immediately after
the `BT` (Begin Text) operator.
---
#### πWhat the example shows
- Shows how to use **`PDFStreamParser`** to access and modify PDF operators.
- Demonstrates rebuilding content streams with **`ContentStreamWriter`**.
- Converts standard RGB values (0β255) into PDF-compatible color space (0.0β1.0).
- Uses only public PDFBox API classes β no private/internal APIs.
Before:
<img width="961" height="519" alt="Screenshot 2025-10-30 220526" src="https://github.com/user-attachments/assets/72e740b3-7704-430e-877a-9f9ee38f1b06" />
After:
<img width="928" height="509" alt="Screenshot 2025-10-30 220700" src="https://github.com/user-attachments/assets/4b67b836-acb7-4243-a4f8-9e67e9968778" />
PS: Both are screenshot of a resume of mine
---
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] add ChangeTextColor example to modify text color in PDF documents [pdfbox]
Posted by "THausherr (via GitHub)" <gi...@apache.org>.
THausherr commented on PR #303:
URL: https://github.com/apache/pdfbox/pull/303#issuecomment-3533302521
Sorry for the late reaction. I'm kinda undecided. The problem is that this will work only for very simple cases, where the text is in the top content stream.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] add ChangeTextColor example to modify text color in PDF documents [pdfbox]
Posted by "KrishVij (via GitHub)" <gi...@apache.org>.
KrishVij commented on PR #303:
URL: https://github.com/apache/pdfbox/pull/303#issuecomment-3533223751
Can anybody atleast tell was contribution not uypto the mark it will mean a lot to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] add ChangeTextColor example to modify text color in PDF documents [pdfbox]
Posted by "KrishVij (via GitHub)" <gi...@apache.org>.
KrishVij closed pull request #303: add ChangeTextColor example to modify text color in PDF documents
URL: https://github.com/apache/pdfbox/pull/303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] add ChangeTextColor example to modify text color in PDF documents [pdfbox]
Posted by "THausherr (via GitHub)" <gi...@apache.org>.
THausherr commented on PR #303:
URL: https://github.com/apache/pdfbox/pull/303#issuecomment-3538480056
Look at the examples subproject and then look at the RemoveAllText.java example, this processes form objects and patterns too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: [PR] add ChangeTextColor example to modify text color in PDF documents [pdfbox]
Posted by "KrishVij (via GitHub)" <gi...@apache.org>.
KrishVij commented on PR #303:
URL: https://github.com/apache/pdfbox/pull/303#issuecomment-3533616392
Greetings Mr/Ms Maintainer
Pls dont be sorry! I can understand that being a maintainer of a big open
source project like this will be of course time consuming and hard. Pls
decide and let me know whether this will be merged and on the flip note if
you can tell me where to study more about the content streams I will really
appreciate it as I did read the spec but due to my current experience and
current expertise it was a bit hard to understand these complex concepts
On Fri, 14 Nov 2025, 21:00 Tilman Hausherr, ***@***.***>
wrote:
> *THausherr* left a comment (apache/pdfbox#303)
> <https://github.com/apache/pdfbox/pull/303#issuecomment-3533302521>
>
> Sorry for the late reaction. I'm kinda undecided. The problem is that this
> will work only for very simple cases, where the text is in the top content
> stream.
>
> β
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/pdfbox/pull/303#issuecomment-3533302521>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BMRREIDARXK26C7PUC4NNPD34XYSDAVCNFSM6AAAAACKV6VG3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMZTGMYDENJSGE>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org