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 - Inserting text behind existing text
  FAQ FAQ  Forum Search   Register Register  Login Login

Inserting text behind existing text

 Post Reply Post Reply
Author
Message
BobW View Drop Down
Senior Member
Senior Member


Joined: 27 Feb 13
Location: Minnesota
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobW Quote  Post ReplyReply Direct Link To This Post Topic: Inserting text behind existing text
    Posted: 18 Mar 13 at 9:17PM
I would like to open a PDF and add text to it.  I would like the text I add to be behind any existing text or graphics on the page.  I can't quite figure out how to do this!

Thanks,

Bob
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 Mar 13 at 10:18PM
Hi Bob!

QP offers extract functionalities. Please read here:
http://www.debenu.com/docs/pdf_library_reference/Extraction.php
There are options to extract with string positions included.
So you can determine where's the text content on each pages.
Additionally QP tells you the complete page dimensions and with
GetOrigin tells you where to begin and SetMeasurementUnits you
can tell QP about the units you wanna use.
So you can calculate the region which should be still clear.
Now you can use the drawing functionalities for your own text.

Cheers, Ingo


Back to Top
BobW View Drop Down
Senior Member
Senior Member


Joined: 27 Feb 13
Location: Minnesota
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobW Quote  Post ReplyReply Direct Link To This Post Posted: 19 Mar 13 at 4:05PM
I'm familiar with the extract functions and I use them in other applications.  For the job I am working on now, I need to place additional text in the PDF and make it look as if the text that is already there was printed on top of if. This is for artistic reasons.  Is there a way to do this?
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 Mar 13 at 5:01PM
So you need the position- and font-values from the extract-functions (chose the right options).
Calculate a little bit with these values and draw onto the existing content.
 
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: 21 Mar 13 at 8:05AM
Bob,

You could try something along the lines of the following

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

   QP.SetOrigin(1);
   QP.AddStandardFont(4);
   QP.SetTextSize(30);
   QP.DrawText(20,20, "Hello World");

   QP.MoveContentStream(cs, 1);

   QP.SaveToFile("newfile.pdf");

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.


Andrew
Back to Top
BobW View Drop Down
Senior Member
Senior Member


Joined: 27 Feb 13
Location: Minnesota
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobW Quote  Post ReplyReply Direct Link To This Post Posted: 22 Mar 13 at 3:02PM
Andrew,

That does the trick!  Thanks so much!

Bob
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