Print Page | Close Window

Is there a replace text function in QuickPdf

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2651
Printed Date: 02 May 24 at 6:08AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Is there a replace text function in QuickPdf
Posted By: JMLM
Subject: Is there a replace text function in QuickPdf
Date Posted: 23 May 13 at 8:19AM
hi,
Is there a replace text function in QuickPDF (with Dll and Dylib version).
Change a short word or a tag.

Cheers
Jim.



Replies:
Posted By: Ingo
Date Posted: 23 May 13 at 9:05AM
Hi Jim!
 
There isn't a replace text function.
Changing the free text content isn't easy stuff for such a light weight library.
Tag data (like meta data) you can change easily.
Please have a look in the online reference...
 
Cheers, Ingo
 


Posted By: JMLM
Date Posted: 23 May 13 at 10:17AM
ok thanks Ingo for your support.
Jim


Posted By: AndrewC
Date Posted: 24 May 13 at 12:32PM
Jim,

QPL has hundreds of functions and even ones I have need seen before.  There is a QP.ReplaceTag function  that searches for text within the content stream an replaces the text with a new value.  This may or may not work as expected based on the complexity of the document including fonts and the uniqueness of the tag.  Text will not be rewrapped and spacing of other text elements may or may not be affected.

QP.LoadFromFile("99pages.pdf", "");
QP.ReplaceText("Page 19", "Page 99")  // This shouldn't cause too many problems.
QP.SaveToFile("out.pdf");

Andrew


Posted By: mandriospo
Date Posted: 05 Apr 23 at 8:01AM
Originally posted by AndrewC AndrewC wrote:

QP.LoadFromFile("99pages.pdf", "");
QP.ReplaceText("Page 19", "Page 99")  // This shouldn't cause too many problems.
QP.SaveToFile("out.pdf");

your sample code is wrong, there is no such a ReplaceText function, you mean ReplaceTag?


Posted By: Ingo
Date Posted: 05 Apr 23 at 7:42PM
Inside the post of AndrewC (R.I.P.) he has written ReplaceTag and that's the correct function:
https://www.debenu.com/docs/pdf_library_reference/ReplaceTag.php
First you have to do a SelectPage for positioning because without this only the current page will be examined:
https://www.debenu.com/docs/pdf_library_reference/SelectPage.php
Please keep in mind that this functionality doesn't work on all pdf-documents. It won't work for example on documents with LZW-compression.
If your documents are encrypted then the text you're looking for is encrypted, too. In this case you have to decrypt the document first before you can use ReplaceTag:
If QP.EncriptionStatus > 0 Then
   QP.Decrypt;
It should be clear that after ReplaceTag you've to do a save and new load to see the differences.

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk