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/08/19 02:53:22 UTC

watermark text issue

i have question regarding watermarks

so i have created some transparent like text in the content stream to mimic
a watermark

problem is, it can still be selected. is there an option in content stream
to flatten this?

i read about overlay but my code is already catered to content stream. so
would be nice not having to use overlay if possible

any ideas?

mark

Re: watermark text issue

Posted by chitgoks <ch...@gmail.com>.
okay

thank you

On Sun, 20 Aug 2017 at 6:41 PM Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 20.08.2017 um 12:34 schrieb chitgoks:
> > ok. for watermark, here is the sample pdf. this is the same link i gave
> to
> > maruan
> >
> >
> https://www.dropbox.com/sh/f5zfhh00jhab48n/AABMJ4wpqeyNrmRFhKQPh_Gfa?dl=0
> >
> > the code i use for watermark is this. i did save the graphic state then
> > restored it. the issue is that the transparent text i created is
> selectable.
>
> That one was already answered: use an image.
>
> Tilman
>
> >
> > PDFont font = PDType1Font.HELVETICA;
> > float fontSize = 80f;
> > PDPageTree pages = pdfDocument.getPages();
> >
> > PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
> > gs.setNonStrokingAlphaConstant(0.3f);
> > PDPage page = pages.get(0);
> >
> > try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
> > AppendMode.APPEND, true, true)) {
> >        cs.setFont(font, fontSize);
> >        cs.setNonStrokingColor(Color.GRAY);
> >        cs.setGraphicsStateParameters(gs);
> >        for (int w=0; w<watermark.size(); w++) {
> > float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 *
> > fontSize;
> > float fontHeight = 15;
> > cs.saveGraphicsState();
> > cs.beginText();
> > if (watermark.size() == 1)
> >       cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> > (page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
> > (page.getCropBox().getHeight() + stringWidth) / 2));
> > else if (watermark.size() == 2) {
> >       cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> > (page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
> > fontHeight),
> > (page.getCropBox().getHeight() + stringWidth) / 2));
> > }
> > else {
> >       float fontHeightValueToUse = fontHeight / 2;
> >       if (w == 0)
> > fontHeightValueToUse = -(fontHeight * 2);
> >       else if (w == 2)
> > fontHeightValueToUse = fontHeight * 3;
> >
> >       cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> > (page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
> > (page.getCropBox().getHeight() + stringWidth) / 2));
> > }
> > cs.showText(watermark.get(w));
> > cs.endText();
> > cs.restoreGraphicsState();
> >        }
> > } catch (Exception e) {
> >
> > }
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
> --
Website/Java Games: http://www.chitgoks.com
My Blogs:
http://tech.chitgoks.com
http://wuhtevah.chitgoks.com
http://disneyusa.blogspot.com

Re: watermark text issue

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 20.08.2017 um 12:34 schrieb chitgoks:
> ok. for watermark, here is the sample pdf. this is the same link i gave to
> maruan
>
> https://www.dropbox.com/sh/f5zfhh00jhab48n/AABMJ4wpqeyNrmRFhKQPh_Gfa?dl=0
>
> the code i use for watermark is this. i did save the graphic state then
> restored it. the issue is that the transparent text i created is selectable.

That one was already answered: use an image.

Tilman

>
> PDFont font = PDType1Font.HELVETICA;
> float fontSize = 80f;
> PDPageTree pages = pdfDocument.getPages();
>
> PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
> gs.setNonStrokingAlphaConstant(0.3f);
> PDPage page = pages.get(0);
>
> try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
> AppendMode.APPEND, true, true)) {
>        cs.setFont(font, fontSize);
>        cs.setNonStrokingColor(Color.GRAY);
>        cs.setGraphicsStateParameters(gs);
>        for (int w=0; w<watermark.size(); w++) {
> float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 *
> fontSize;
> float fontHeight = 15;
> cs.saveGraphicsState();
> cs.beginText();
> if (watermark.size() == 1)
>       cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> (page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
> (page.getCropBox().getHeight() + stringWidth) / 2));
> else if (watermark.size() == 2) {
>       cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> (page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
> fontHeight),
> (page.getCropBox().getHeight() + stringWidth) / 2));
> }
> else {
>       float fontHeightValueToUse = fontHeight / 2;
>       if (w == 0)
> fontHeightValueToUse = -(fontHeight * 2);
>       else if (w == 2)
> fontHeightValueToUse = fontHeight * 3;
>
>       cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> (page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
> (page.getCropBox().getHeight() + stringWidth) / 2));
> }
> cs.showText(watermark.get(w));
> cs.endText();
> cs.restoreGraphicsState();
>        }
> } catch (Exception e) {
>
> }
>


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


Re: watermark text issue

Posted by chitgoks <ch...@gmail.com>.
ok. for watermark, here is the sample pdf. this is the same link i gave to
maruan

https://www.dropbox.com/sh/f5zfhh00jhab48n/AABMJ4wpqeyNrmRFhKQPh_Gfa?dl=0

the code i use for watermark is this. i did save the graphic state then
restored it. the issue is that the transparent text i created is selectable.

PDFont font = PDType1Font.HELVETICA;
float fontSize = 80f;
PDPageTree pages = pdfDocument.getPages();

PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
gs.setNonStrokingAlphaConstant(0.3f);
PDPage page = pages.get(0);

try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
AppendMode.APPEND, true, true)) {
      cs.setFont(font, fontSize);
      cs.setNonStrokingColor(Color.GRAY);
      cs.setGraphicsStateParameters(gs);
      for (int w=0; w<watermark.size(); w++) {
float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 *
fontSize;
float fontHeight = 15;
cs.saveGraphicsState();
cs.beginText();
if (watermark.size() == 1)
     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
(page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
(page.getCropBox().getHeight() + stringWidth) / 2));
else if (watermark.size() == 2) {
     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
(page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
fontHeight),
(page.getCropBox().getHeight() + stringWidth) / 2));
}
else {
     float fontHeightValueToUse = fontHeight / 2;
     if (w == 0)
fontHeightValueToUse = -(fontHeight * 2);
     else if (w == 2)
fontHeightValueToUse = fontHeight * 3;

     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
(page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
(page.getCropBox().getHeight() + stringWidth) / 2));
}
cs.showText(watermark.get(w));
cs.endText();
cs.restoreGraphicsState();
      }
} catch (Exception e) {

}

Re: watermark text issue

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 20.08.2017 um 10:25 schrieb chitgoks:
> hi tilman
>
> i dont understand though. the reason why i save the graphic state is so
> that i could rotate the watermark text to vertical and restore it so the
> page's original contents will not be rotated.
>
> or i did it the wrong way?

Yes. First save the graphics state, then modify it, do your stuff, then 
restore the graphics state.

Btw please concentrate on one single solution. Post the code for that 
and upload the PDF and explain what went wrong. Currently you've posted 
code for one solution and we are discussing another.

Tilman

>
> please advise
>
> thank you
>
>
> On Sun, Aug 20, 2017 at 4:20 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> You first call "cs.setGraphicsStateParameters(gs)" and then save the
>> graphics state. So the setting will be kept even after you've called
>> "cs.restoreGraphicsState();".
>>
>> Tilman
>>
>> Am 20.08.2017 um 09:33 schrieb chitgoks:
>>
>>> hi tilman
>>>
>>> yes. the watermark is appended to an existing pdf. and my 5th parameter is
>>> true
>>>
>>> i just want it not to be selectable. prepend would have worked. but for an
>>> existing page, what happens is that since i made the watermark text
>>> transparent, the page's text also gets transparent.
>>>
>>> this is my code. watermarks is an arraylist of string. max of 3.
>>>
>>> PDFont font = PDType1Font.HELVETICA;
>>> float fontSize = 80f;
>>> PDPageTree pages = pdfDocument.getPages();
>>>
>>> PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
>>> gs.setNonStrokingAlphaConstant(0.3f);
>>> PDPage page = pages.get(0);
>>>
>>> try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
>>> AppendMode.APPEND, true, true)) {
>>>       cs.setFont(font, fontSize);
>>>       cs.setNonStrokingColor(Color.GRAY);
>>>       cs.setGraphicsStateParameters(gs);
>>>       for (int w=0; w<watermark.size(); w++) {
>>> float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 *
>>> fontSize;
>>> float fontHeight = 15;
>>> cs.saveGraphicsState();
>>> cs.beginText();
>>> if (watermark.size() == 1)
>>>      cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
>>> (page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
>>> (page.getCropBox().getHeight() + stringWidth) / 2));
>>> else if (watermark.size() == 2) {
>>>      cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
>>> (page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
>>> fontHeight),
>>> (page.getCropBox().getHeight() + stringWidth) / 2));
>>> }
>>> else {
>>>      float fontHeightValueToUse = fontHeight / 2;
>>>      if (w == 0)
>>> fontHeightValueToUse = -(fontHeight * 2);
>>>      else if (w == 2)
>>> fontHeightValueToUse = fontHeight * 3;
>>>
>>>      cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
>>> (page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
>>> (page.getCropBox().getHeight() + stringWidth) / 2));
>>> }
>>> cs.showText(watermark.get(w));
>>> cs.endText();
>>> cs.restoreGraphicsState();
>>>       }
>>> } catch (Exception e) {
>>>
>>> }
>>>
>>> Website/Java Games: http://www.chitgoks.com
>>> My Blogs:
>>> http://tech.chitgoks.com
>>> http://wuhtevah.chitgoks.com
>>> http://disneyusa.blogspot.com
>>>
>>> On Sun, Aug 20, 2017 at 2:56 PM, Tilman Hausherr <TH...@t-online.de>
>>> wrote:
>>>
>>> Am 20.08.2017 um 08:38 schrieb chitgoks:
>>>> Hi gilad. thank you for replying
>>>>> there should still be some way to do this right? if not the content
>>>>> stream
>>>>> then i guess the only other way is via overlays
>>>>>
>>>>> Are you aware that you can always add a content stream to an existing
>>>> page? Either prepend or append. When appending, use the constructor with
>>>> 5
>>>> parameters and set the last to true. For a watermark, prepend is probably
>>>> better.
>>>>
>>>> Tilman
>>>>


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


Re: watermark text issue

Posted by chitgoks <ch...@gmail.com>.
hi tilman

i dont understand though. the reason why i save the graphic state is so
that i could rotate the watermark text to vertical and restore it so the
page's original contents will not be rotated.

or i did it the wrong way?

please advise

thank you


On Sun, Aug 20, 2017 at 4:20 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> You first call "cs.setGraphicsStateParameters(gs)" and then save the
> graphics state. So the setting will be kept even after you've called
> "cs.restoreGraphicsState();".
>
> Tilman
>
> Am 20.08.2017 um 09:33 schrieb chitgoks:
>
>> hi tilman
>>
>> yes. the watermark is appended to an existing pdf. and my 5th parameter is
>> true
>>
>> i just want it not to be selectable. prepend would have worked. but for an
>> existing page, what happens is that since i made the watermark text
>> transparent, the page's text also gets transparent.
>>
>> this is my code. watermarks is an arraylist of string. max of 3.
>>
>> PDFont font = PDType1Font.HELVETICA;
>> float fontSize = 80f;
>> PDPageTree pages = pdfDocument.getPages();
>>
>> PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
>> gs.setNonStrokingAlphaConstant(0.3f);
>> PDPage page = pages.get(0);
>>
>> try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
>> AppendMode.APPEND, true, true)) {
>>      cs.setFont(font, fontSize);
>>      cs.setNonStrokingColor(Color.GRAY);
>>      cs.setGraphicsStateParameters(gs);
>>      for (int w=0; w<watermark.size(); w++) {
>> float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 *
>> fontSize;
>> float fontHeight = 15;
>> cs.saveGraphicsState();
>> cs.beginText();
>> if (watermark.size() == 1)
>>     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
>> (page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
>> (page.getCropBox().getHeight() + stringWidth) / 2));
>> else if (watermark.size() == 2) {
>>     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
>> (page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
>> fontHeight),
>> (page.getCropBox().getHeight() + stringWidth) / 2));
>> }
>> else {
>>     float fontHeightValueToUse = fontHeight / 2;
>>     if (w == 0)
>> fontHeightValueToUse = -(fontHeight * 2);
>>     else if (w == 2)
>> fontHeightValueToUse = fontHeight * 3;
>>
>>     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
>> (page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
>> (page.getCropBox().getHeight() + stringWidth) / 2));
>> }
>> cs.showText(watermark.get(w));
>> cs.endText();
>> cs.restoreGraphicsState();
>>      }
>> } catch (Exception e) {
>>
>> }
>>
>> Website/Java Games: http://www.chitgoks.com
>> My Blogs:
>> http://tech.chitgoks.com
>> http://wuhtevah.chitgoks.com
>> http://disneyusa.blogspot.com
>>
>> On Sun, Aug 20, 2017 at 2:56 PM, Tilman Hausherr <TH...@t-online.de>
>> wrote:
>>
>> Am 20.08.2017 um 08:38 schrieb chitgoks:
>>>
>>> Hi gilad. thank you for replying
>>>>
>>>> there should still be some way to do this right? if not the content
>>>> stream
>>>> then i guess the only other way is via overlays
>>>>
>>>> Are you aware that you can always add a content stream to an existing
>>> page? Either prepend or append. When appending, use the constructor with
>>> 5
>>> parameters and set the last to true. For a watermark, prepend is probably
>>> better.
>>>
>>> Tilman
>>>
>>

Re: watermark text issue

Posted by Tilman Hausherr <TH...@t-online.de>.
You first call "cs.setGraphicsStateParameters(gs)" and then save the 
graphics state. So the setting will be kept even after you've called 
"cs.restoreGraphicsState();".

Tilman

Am 20.08.2017 um 09:33 schrieb chitgoks:
> hi tilman
>
> yes. the watermark is appended to an existing pdf. and my 5th parameter is
> true
>
> i just want it not to be selectable. prepend would have worked. but for an
> existing page, what happens is that since i made the watermark text
> transparent, the page's text also gets transparent.
>
> this is my code. watermarks is an arraylist of string. max of 3.
>
> PDFont font = PDType1Font.HELVETICA;
> float fontSize = 80f;
> PDPageTree pages = pdfDocument.getPages();
>
> PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
> gs.setNonStrokingAlphaConstant(0.3f);
> PDPage page = pages.get(0);
>
> try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
> AppendMode.APPEND, true, true)) {
>      cs.setFont(font, fontSize);
>      cs.setNonStrokingColor(Color.GRAY);
>      cs.setGraphicsStateParameters(gs);
>      for (int w=0; w<watermark.size(); w++) {
> float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 * fontSize;
> float fontHeight = 15;
> cs.saveGraphicsState();
> cs.beginText();
> if (watermark.size() == 1)
>     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> (page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
> (page.getCropBox().getHeight() + stringWidth) / 2));
> else if (watermark.size() == 2) {
>     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> (page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
> fontHeight),
> (page.getCropBox().getHeight() + stringWidth) / 2));
> }
> else {
>     float fontHeightValueToUse = fontHeight / 2;
>     if (w == 0)
> fontHeightValueToUse = -(fontHeight * 2);
>     else if (w == 2)
> fontHeightValueToUse = fontHeight * 3;
>
>     cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
> (page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
> (page.getCropBox().getHeight() + stringWidth) / 2));
> }
> cs.showText(watermark.get(w));
> cs.endText();
> cs.restoreGraphicsState();
>      }
> } catch (Exception e) {
>
> }
>
> Website/Java Games: http://www.chitgoks.com
> My Blogs:
> http://tech.chitgoks.com
> http://wuhtevah.chitgoks.com
> http://disneyusa.blogspot.com
>
> On Sun, Aug 20, 2017 at 2:56 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Am 20.08.2017 um 08:38 schrieb chitgoks:
>>
>>> Hi gilad. thank you for replying
>>>
>>> there should still be some way to do this right? if not the content stream
>>> then i guess the only other way is via overlays
>>>
>> Are you aware that you can always add a content stream to an existing
>> page? Either prepend or append. When appending, use the constructor with 5
>> parameters and set the last to true. For a watermark, prepend is probably
>> better.
>>
>> Tilman
>>
>>
>>> Website/Java Games: http://www.chitgoks.com
>>> My Blogs:
>>> http://tech.chitgoks.com
>>> http://wuhtevah.chitgoks.com
>>> http://disneyusa.blogspot.com
>>>
>>> On Sat, Aug 19, 2017 at 4:42 PM, Gilad Denneboom <
>>> gilad.denneboom@gmail.com>
>>> wrote:
>>>
>>> If you're adding text it will always be selectable. If you don't want it
>>>> to
>>>> be you need to use an image.
>>>>
>>>> On Sat, Aug 19, 2017 at 4:53 AM, chitgoks <ch...@gmail.com> wrote:
>>>>
>>>> i have question regarding watermarks
>>>>> so i have created some transparent like text in the content stream to
>>>>>
>>>> mimic
>>>>
>>>>> a watermark
>>>>>
>>>>> problem is, it can still be selected. is there an option in content
>>>>>
>>>> stream
>>>>
>>>>> to flatten this?
>>>>>
>>>>> i read about overlay but my code is already catered to content stream.
>>>>> so
>>>>> would be nice not having to use overlay if possible
>>>>>
>>>>> any ideas?
>>>>>
>>>>> mark
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


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


Re: watermark text issue

Posted by chitgoks <ch...@gmail.com>.
hi tilman

yes. the watermark is appended to an existing pdf. and my 5th parameter is
true

i just want it not to be selectable. prepend would have worked. but for an
existing page, what happens is that since i made the watermark text
transparent, the page's text also gets transparent.

this is my code. watermarks is an arraylist of string. max of 3.

PDFont font = PDType1Font.HELVETICA;
float fontSize = 80f;
PDPageTree pages = pdfDocument.getPages();

PDExtendedGraphicsState gs = new PDExtendedGraphicsState();
gs.setNonStrokingAlphaConstant(0.3f);
PDPage page = pages.get(0);

try (PDPageContentStream cs = new PDPageContentStream(pdfDocument, page,
AppendMode.APPEND, true, true)) {
    cs.setFont(font, fontSize);
    cs.setNonStrokingColor(Color.GRAY);
    cs.setGraphicsStateParameters(gs);
    for (int w=0; w<watermark.size(); w++) {
float stringWidth = font.getStringWidth(watermark.get(w)) / 1000 * fontSize;
float fontHeight = 15;
cs.saveGraphicsState();
cs.beginText();
if (watermark.size() == 1)
   cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
(page.getCropBox().getWidth() - (fontHeight / 2)) / 2,
(page.getCropBox().getHeight() + stringWidth) / 2));
else if (watermark.size() == 2) {
   cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
(page.getCropBox().getWidth() / 2) - (w == 0 ? -(fontHeight / 2) :
fontHeight),
(page.getCropBox().getHeight() + stringWidth) / 2));
}
else {
   float fontHeightValueToUse = fontHeight / 2;
   if (w == 0)
fontHeightValueToUse = -(fontHeight * 2);
   else if (w == 2)
fontHeightValueToUse = fontHeight * 3;

   cs.transform(Matrix.getRotateInstance(Math.toRadians(270),
(page.getCropBox().getWidth() - fontHeightValueToUse) / 2,
(page.getCropBox().getHeight() + stringWidth) / 2));
}
cs.showText(watermark.get(w));
cs.endText();
cs.restoreGraphicsState();
    }
} catch (Exception e) {

}

Website/Java Games: http://www.chitgoks.com
My Blogs:
http://tech.chitgoks.com
http://wuhtevah.chitgoks.com
http://disneyusa.blogspot.com

On Sun, Aug 20, 2017 at 2:56 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 20.08.2017 um 08:38 schrieb chitgoks:
>
>> Hi gilad. thank you for replying
>>
>> there should still be some way to do this right? if not the content stream
>> then i guess the only other way is via overlays
>>
>
> Are you aware that you can always add a content stream to an existing
> page? Either prepend or append. When appending, use the constructor with 5
> parameters and set the last to true. For a watermark, prepend is probably
> better.
>
> Tilman
>
>
>> Website/Java Games: http://www.chitgoks.com
>> My Blogs:
>> http://tech.chitgoks.com
>> http://wuhtevah.chitgoks.com
>> http://disneyusa.blogspot.com
>>
>> On Sat, Aug 19, 2017 at 4:42 PM, Gilad Denneboom <
>> gilad.denneboom@gmail.com>
>> wrote:
>>
>> If you're adding text it will always be selectable. If you don't want it
>>> to
>>> be you need to use an image.
>>>
>>> On Sat, Aug 19, 2017 at 4:53 AM, chitgoks <ch...@gmail.com> wrote:
>>>
>>> i have question regarding watermarks
>>>>
>>>> so i have created some transparent like text in the content stream to
>>>>
>>> mimic
>>>
>>>> a watermark
>>>>
>>>> problem is, it can still be selected. is there an option in content
>>>>
>>> stream
>>>
>>>> to flatten this?
>>>>
>>>> i read about overlay but my code is already catered to content stream.
>>>> so
>>>> would be nice not having to use overlay if possible
>>>>
>>>> any ideas?
>>>>
>>>> mark
>>>>
>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: watermark text issue

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 20.08.2017 um 08:38 schrieb chitgoks:
> Hi gilad. thank you for replying
>
> there should still be some way to do this right? if not the content stream
> then i guess the only other way is via overlays

Are you aware that you can always add a content stream to an existing 
page? Either prepend or append. When appending, use the constructor with 
5 parameters and set the last to true. For a watermark, prepend is 
probably better.

Tilman

>
> Website/Java Games: http://www.chitgoks.com
> My Blogs:
> http://tech.chitgoks.com
> http://wuhtevah.chitgoks.com
> http://disneyusa.blogspot.com
>
> On Sat, Aug 19, 2017 at 4:42 PM, Gilad Denneboom <gi...@gmail.com>
> wrote:
>
>> If you're adding text it will always be selectable. If you don't want it to
>> be you need to use an image.
>>
>> On Sat, Aug 19, 2017 at 4:53 AM, chitgoks <ch...@gmail.com> wrote:
>>
>>> i have question regarding watermarks
>>>
>>> so i have created some transparent like text in the content stream to
>> mimic
>>> a watermark
>>>
>>> problem is, it can still be selected. is there an option in content
>> stream
>>> to flatten this?
>>>
>>> i read about overlay but my code is already catered to content stream. so
>>> would be nice not having to use overlay if possible
>>>
>>> any ideas?
>>>
>>> mark
>>>


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


Re: watermark text issue

Posted by chitgoks <ch...@gmail.com>.
Hi gilad. thank you for replying

there should still be some way to do this right? if not the content stream
then i guess the only other way is via overlays

Website/Java Games: http://www.chitgoks.com
My Blogs:
http://tech.chitgoks.com
http://wuhtevah.chitgoks.com
http://disneyusa.blogspot.com

On Sat, Aug 19, 2017 at 4:42 PM, Gilad Denneboom <gi...@gmail.com>
wrote:

> If you're adding text it will always be selectable. If you don't want it to
> be you need to use an image.
>
> On Sat, Aug 19, 2017 at 4:53 AM, chitgoks <ch...@gmail.com> wrote:
>
> > i have question regarding watermarks
> >
> > so i have created some transparent like text in the content stream to
> mimic
> > a watermark
> >
> > problem is, it can still be selected. is there an option in content
> stream
> > to flatten this?
> >
> > i read about overlay but my code is already catered to content stream. so
> > would be nice not having to use overlay if possible
> >
> > any ideas?
> >
> > mark
> >
>

Re: watermark text issue

Posted by Gilad Denneboom <gi...@gmail.com>.
If you're adding text it will always be selectable. If you don't want it to
be you need to use an image.

On Sat, Aug 19, 2017 at 4:53 AM, chitgoks <ch...@gmail.com> wrote:

> i have question regarding watermarks
>
> so i have created some transparent like text in the content stream to mimic
> a watermark
>
> problem is, it can still be selected. is there an option in content stream
> to flatten this?
>
> i read about overlay but my code is already catered to content stream. so
> would be nice not having to use overlay if possible
>
> any ideas?
>
> mark
>