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 > General Discussion
  New Posts New Posts RSS Feed - How Make ReplaceTag?
  FAQ FAQ  Forum Search   Register Register  Login Login

How Make ReplaceTag?

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


Joined: 11 Dec 21
Location: State
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote muljt Quote  Post ReplyReply Direct Link To This Post Topic: How Make ReplaceTag?
    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 :(

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
muljt View Drop Down
Beginner
Beginner


Joined: 11 Dec 21
Location: State
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote muljt Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 21 at 7:35PM
did you do the decryption first?

Cheers,
Ingo

Back to Top
muljt View Drop Down
Beginner
Beginner


Joined: 11 Dec 21
Location: State
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote muljt Quote  Post ReplyReply Direct Link To This Post 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....

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

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