unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.47k stars 250 forks source link

[FEATURE] Ability to set opacity on styledParagraph #505

Closed soapiestwaffles closed 1 year ago

soapiestwaffles commented 1 year ago

We have a use case where we require to write text over the top of existing text, but, we need this new text to not be fully opaque. Is there any way currently, that maybe I'm just not seeing in the docs, to set opacity on a StyledParagraph similar to how you can set opacity on a drawn line?

github-actions[bot] commented 1 year ago

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

sampila commented 1 year ago

Hi @soapiestwaffles, The StyledParagraph works different compared to the graphic elements. Could you explain your use case and probably give us your desired PDF results with text opacity, so we can understand and try to create example that match your use case.

Best regards, Alip

soapiestwaffles commented 1 year ago

I was pretty sure this was the case, but thought I would make a feature request and see.

The use-case would be adding semi-transparent text over the top of another block of text. I.e. "DRAFT" over a small paragraph or something.

I suppose I could always do a workaround of rendering the text to an image and then using transparency on the image. If you have a better way to do it, though, I would definitely love to hear it!

sampila commented 1 year ago

If your use case is adding a DRAFT text like watermark into PDF page, probably you can try this example: https://github.com/unidoc/unipdf-examples/blob/aad607a68160971dacc06a37b88568b64625b8be/image/pdf_watermark_image.go

soapiestwaffles commented 1 year ago

yeah, I'll just rasterize whatever text the user inputs to an image and then use it like in that example. That will work. Thank you :)

sampila commented 1 year ago

You are welcome, glad to hear that :)