Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Add Watermark behind PDF Text
  FAQ FAQ  Forum Search   Register Register  Login Login

Add Watermark behind PDF Text

 Post Reply Post Reply
Author
Message
chrisreed View Drop Down
Team Player
Team Player
Avatar

Joined: 29 Apr 13
Location: Australia
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisreed Quote  Post ReplyReply Direct Link To This Post Topic: Add Watermark behind PDF Text
    Posted: 18 Jun 13 at 9:28AM
I followed the QuickPDF example on how to add a Watermark to an existing PDF Document which all worked fine, except the Watermark was inserted infront of the existing PDF text.
 
How can I insert the watermark behind the existing PDF text.
 
See link below to which shows the difference....
 
NOTE: Making the watermark semi-transparent is not the affect I am really after.
 
Chris
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 18 Jun 13 at 10:34AM
Hi Chris!
 
That's heavy stuff!
There's no sample here.
You should read about layers and (optional) content groups in the reference.
You have to recreate the whole document for this (taking the layers away... drawing the watermark... then the layers back... puuuuh :)
Nearly the same and much easier it is to put a bit more transparency to the watermark ;-)
 
Cheers, Ingo
 
Back to Top
chrisreed View Drop Down
Team Player
Team Player
Avatar

Joined: 29 Apr 13
Location: Australia
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisreed Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jun 13 at 2:26AM
Damn.  I was hoping there was a Method like "Appear Behind Text" or something similar.
How do I put in request for a Method like this be added to the next version as I feel it is a very useful feature for things like Watermarks.
 
As for adding more transparency I'm in a Catch-22 situation.  I have to add more transparency so I can see the text behind the watermark, but if I make it too transparent then the Watermark does not come out if the report is photocopied - maybe I can get away with a happy compromise.
 
Thanks Ingo for the reply.
Back to Top
chrisreed View Drop Down
Team Player
Team Player
Avatar

Joined: 29 Apr 13
Location: Australia
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisreed Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jun 13 at 5:27AM
Hi again,
There was a post that explained how to insert text behind text using Streams (see link) which I thought I could use with my Watermark issue.
 
 
My original PDF seemed to have two ContentStreams and I created a NewContentStream (No. 3) added the image and then used the MoveContentStream function to move it from Stream 3 to Stream 1.  But it didn't matter what streams I moved around or where I added the image (before or after a NewStream was created) the watermark always appeared on top of the original text.
 
Can my issue be solved using ContentStreams?
 
Chris
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jun 13 at 10:29AM

Can my issue be solved using ContentStreams?

Hi Chris!

That's what i told.
But you should try - seems here in the user forum there's nobody doing this before.
If you want to post new user ideas/-requests you should go onto the official pages (have a click on the logo at the top, left).
BTW: Creating a new document there's always one blank page and one layer/contentgroup.

Cheers, Ingo

 

Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jun 13 at 4:22AM
You could try something along the lines of the following which I have adapted from http://www.quickpdf.org/forum/inserting-text-behind-existing-text_topic2570_post10615.html?KW=behind+text#10615

   QP.LoadFromFile (...
   QP.SelectPage(1);
   int cs = NewContentStream();

   QP.SetOrigin(1);

   int img = QP.AddImageFromFile("myimage.png", 0);
   QP.DrawImage(0,0,QP.PageWidth(), QP.PageHeight();

   QP.MoveContentStream(cs, 1);

   QP.SaveToFile("newfile.pdf");

Moving the content stream with the image to content stream 1 will mean that the image is draw first and that any test or other logos will be drawn on top.

Whether this approach works or not will depend on how the PDF is created.  If the first command of the PDF is to draw and fill a white rectangle the same size as the page then this approach will not work.

If this doesn't work then you will need to post some code so we can understand what is and isn't working.


Andrew
Back to Top
chrisreed View Drop Down
Team Player
Team Player
Avatar

Joined: 29 Apr 13
Location: Australia
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisreed Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jun 13 at 7:41AM
Ha! Ha! That's the exact same link I mentioned above Tongue  My code is based on your example Andrew - it sort of worked for some PDF's but not for others (see my code below).
 
If I converted a Word document into a PDF using PDF Creator it worked, however if I used a PDF created from a hospital application and moved it to Stream 1, the watermark didn't even appear!!
 
If I moved it to Stream 2, the Watermark appeared in both PDF's but always infront of the text.
 
In both cases the ContentStreamCount was three.  How do I tell if the first command is to draw and fill a white rectangle - could that be the issue?
 
Unfortunately I can't attach the problematic PDF report because it has patient information on it.
 
Chris
 
 
Back to Top
chrisreed View Drop Down
Team Player
Team Player
Avatar

Joined: 29 Apr 13
Location: Australia
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisreed Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jun 13 at 9:21AM
As Andrew mentioned in his previous post, the reason it wasn't working was that the first command in the PDF File was to draw a white rectangle.
 
This can be found using GetPageContentToString (or GetPageContentToVariant - ActiveX version) and you will see something like this at the top of the file.
 

1 g                                   // select White -

0 2.66797 4956 7014 re // create a rectangle

f                                     // fill the rectangle with the white pen

 
And the reason for this was I was printing the PDF indirectly through a Web-based application and not directly through the PDFCreator application.
 
Chris
Back to Top
mat miller View Drop Down
Beginner
Beginner


Joined: 21 Jan 13
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mat miller Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 14 at 4:38AM
Back to Top
chrisreed View Drop Down
Team Player
Team Player
Avatar

Joined: 29 Apr 13
Location: Australia
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisreed Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 14 at 5:24AM
Hi Mat,
Yes I did try that, but its a Catch-22 situation.  I needed to make the Watermark transparent enough so I can still see the text/images behind it, but not too transparent that the Watermark is hard to read.
 
I could not find a suitable compromise between these two conflicting requirements which is why it MUST be placed behind the text/images.
 
Chris
Back to Top
lucy142 View Drop Down
Beginner
Beginner


Joined: 24 Mar 15
Location: U.S
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote lucy142 Quote  Post ReplyReply Direct Link To This Post Posted: 24 Mar 15 at 5:33AM

 Hi Friends,

To add watermark behind pdf text you can go with this perfect PDF watermark for mac software solution to add text/image watermark to every page of a PDF file or behind PDF Text. It facilities you with the realtime preview output effect, Batch watermark PDF files like amazing features.Wink 

For any information about this software you can visit to this link:

http://www.completepdfsolultions.com/pdf-watermark-mac.php

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store