You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by chitgoks <ch...@gmail.com> on 2017/03/10 07:14:22 UTC

flatten text in PDPageContentStream

hi all

so i created some text in PDPageContentStream making it look like a
watermark.

However, i could not find any method that will make it somehow flatten to
the document so it will not be selectable.

Is this possible?

If so, which method or class should i be looking at?

please advise

thank you

mark

Re: flatten text in PDPageContentStream

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 10.03.2017 um 08:14 schrieb chitgoks:
> hi all
>
> so i created some text in PDPageContentStream making it look like a
> watermark.
>
> However, i could not find any method that will make it somehow flatten to
> the document so it will not be selectable.
>
> Is this possible?
>
> If so, which method or class should i be looking at?

The simplest would be to create an transparent ARGB image and draw your 
watermark there and then draw this image into the PDF.

Another idea, which I haven't tested so it's a risk of time loss, would 
be to draw the text in rendering mode 7 (RenderingMode.NEITHER_CLIP), 
this will draw nothing but add the path of your glyphs to the clipping 
region. Then draw a huge rectangle in some color on the whole page. This 
will then draw the text as a shape. But I don't know if this will create 
the watermark effect.

Tilman

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