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 - Replacing text in existing PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Replacing text in existing PDF

 Post Reply Post Reply
Author
Message
amberwine View Drop Down
Beginner
Beginner


Joined: 14 Aug 14
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote amberwine Quote  Post ReplyReply Direct Link To This Post Topic: Replacing text in existing PDF
    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.
Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 14 Aug 14 at 8:31PM
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
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: 15 Aug 14 at 9:57AM
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.


Back to Top
AndyD View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Apr 13
Location: UK
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyD Quote  Post ReplyReply Direct Link To This Post Posted: 18 Aug 14 at 9:02AM
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
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