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!
![]() |
Replacing text in existing PDF |
Post Reply ![]() |
Author | |
amberwine ![]() Beginner ![]() Joined: 14 Aug 14 Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() Posted: 14 Aug 14 at 9:04AM |
I need to replace a small amount of text in an existing PDF file. Ideally, I'd like to use the existing file as a 'template', by:
1. loading it 2. making a copy for output 3. searching the copy for the text to replace 4. replacing the text with new text 5. saving the modified copy The text is currently of the form "<TXT1>" and is to be replaced with a something like "V1234", though the number can vary. I need to produce lots of copies of the original PDF, saving each with a different filename and replacement text. I do have some control over the format of the source PDF, so if modifying the original PDF might make this job easier, please feel free to make suggestions. Can you suggest Debenu QL functions that might help me to: 1. Locate the text in the PDF 2. Replace it with the new text Alternatively, if you point me to some appropriate sample code, that would be great. Many thanks for your help. |
|
![]() |
|
Wheeley ![]() Senior Member ![]() ![]() Joined: 30 Oct 05 Location: United States Status: Offline Points: 146 |
![]() ![]() ![]() ![]() ![]() |
You had better do a forum search about this. It has been answered before. Short answer, it will be extremely difficult because of how PDFs are put together. Not because of the tool you use.
Wheeley |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Amberwine,
A PDF file is a binary format and can also include compressed data. So it is not easily possibly to replace text unless the text is the same length as the text you are replacing. QP.ReplaceTag is designed specifically for this. To get access to the drawing commands you will need to work with the ContentStream functions. http://www.debenu.com/docs/pdf_library_reference/PageManipulation.php. Most of the required functions can be found here. Andrew.
|
|
![]() |
|
AndyD ![]() Senior Member ![]() ![]() Joined: 30 Apr 13 Location: UK Status: Offline Points: 54 |
![]() ![]() ![]() ![]() ![]() |
Alternativey if you have the full version of Acrobat, you could replace the default <txt> locations with form fields and then with QuickPDF you can call and fill these fields as you need. That is the way I have done it to produce filled letters, technical documents etc from within an app.
Andy
|
|
![]() |
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