Print Page | Close Window

Replacing Text in multipage document

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2236
Printed Date: 13 Aug 25 at 5:25PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Replacing Text in multipage document
Posted By: AusMike
Subject: Replacing Text in multipage document
Date Posted: 17 Apr 12 at 1:47AM
I am hoping someone can tell me what I am missing?
 
I need to create two large multipage documents that take several minutes to produce.  The documents are identical except for a couple of pieces of text.  To speed the whole system up, I am trying to create the document with a placeholder for my text, then replace it with he correct text for each file.
 
ie
after I have created the document:
 
quickpdf.CombineContentStreams;

workstring := quickpdf.savetostring;

Newstring := stringreplace(workstring,’@placeholder@’,’new data’,[rfrepalceall]);

i := Quickpdf.loadfromstring(newstring,'');

if = 1 then

begin

      QuickPDf.CompressContent;

     QuickPDf.SaveToFile(filename1);

End;

Newstring := stringreplace(workstring,’@placeholder@’,’alternate data’,[rfrepalceall]);

i := Quickpdf.loadfromstring(newstring,'');

if = 1 then

begin

      QuickPDf.CompressContent;

     QuickPDf.SaveToFile(Filename2);

End;

The saved files have the correct number of pages, but no content (font description,etc is there). 

Is there something else I need to do to get this to work?

I tried looping though the pages and using the page routines (replacetag or getpagecontenttostring), but that only works for the first document.




Replies:
Posted By: AndrewC
Date Posted: 17 Apr 12 at 1:48PM
You probably need to make sure the strings you are replacing are the same length.

Another option is to create the initial document with out the text place holders and then use DrawText later if you know where the text should be drawn.




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