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!
Inserting text behind existing text |
Post Reply |
Author | |
BobW
Senior Member Joined: 27 Feb 13 Location: Minnesota Status: Offline Points: 64 |
Post Options
Thanks(0)
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
BobW
Senior Member Joined: 27 Feb 13 Location: Minnesota Status: Offline Points: 64 |
Post Options
Thanks(0)
|
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?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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. |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
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
|
|
BobW
Senior Member Joined: 27 Feb 13 Location: Minnesota Status: Offline Points: 64 |
Post Options
Thanks(0)
|
Andrew,
That does the trick! Thanks so much! Bob |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store