Print Page | Close Window

How Make ReplaceTag?

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=3965
Printed Date: 03 May 24 at 5:14PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How Make ReplaceTag?
Posted By: muljt
Subject: How Make ReplaceTag?
Date Posted: 11 Dec 21 at 7:37AM
Hello.

I have another pdf file. I want to change its content.
Sample code how I get the text:

var
i,j:integer;
str:string;
begin

j:= PDFLibrary.DAOpenFile('D:\32a0g.pdf','');
i:= PDFLibrary.DAExtractPageTextBlocks(j,PDFLibrary.DAFindPage(j,1),3);
str:=  PDFLibrary.DAGetTextBlockText(i,2);
memo1.Text:= str;

end;

//************ RESULT STR = TEST **********//




how do i change the content of "PDFLibrary.DAGetTextBlockText (i, 2);" on "TSET"

ReplaceTag('TEST','TSET'); - does not work :(




Replies:
Posted By: Ingo
Date Posted: 13 Dec 21 at 8:11PM
Hi Muljtik,

there are still probs while subsetted fonts are used.
Here's a sample how to use the function:
https://www.debenu.com/kb/replace-text-pdf/
...

DPL.CombineContentStreams();
string content = DPL.GetContentStreamToString();
DPL.SetPageContentFromString(content.Replace("Moby", "Mary"));


Cheers and welcome here,
Ingo


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



Posted By: muljt
Date Posted: 14 Dec 21 at 6:40AM
Hi Ingo,

32a0g.pdf - this file not create from PDFLibrary

str := PDFLibrary.GetContentStreamToString();

str Result :
......
......
-96.965 -27.5 Td
<0049006E0020007400...6E0064> Tj
116.281 -13.75 Td

.....
.....

StringReplace - don't finds my text (Delphi code)

Regards.


Posted By: Ingo
Date Posted: 14 Dec 21 at 7:35PM
did you do the decryption first?



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



Posted By: muljt
Date Posted: 15 Dec 21 at 5:16PM
      PDFLibrary.LoadFromFile('D:\a0g1.pdf','');
      i:=PDFLibrary.Decrypt;
      str:= inttostr(i);

     //  PDFLibrary.CombineContentStreams();
    //   str:= PDFLibrary.GetContentStreamToString();


      memo1.Text:= str;
//****************************//

Function Decrypt returns code 0....



Posted By: Ingo
Date Posted: 16 Dec 21 at 8:44PM
0 could mean that the pdf isn't encrypted.
You should try a...
    If PDFLibrary.EncryptionStatus > 0 Then
      PDFLibrary.Decrypt;
...first.



-------------
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