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!
![]() |
How Make ReplaceTag? |
Post Reply ![]() |
Author | |
muljt ![]() Beginner ![]() Joined: 11 Dec 21 Location: State Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() 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 :( |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
muljt ![]() Beginner ![]() Joined: 11 Dec 21 Location: State Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
did you do the decryption first?
|
|
Cheers,
Ingo |
|
![]() |
|
muljt ![]() Beginner ![]() Joined: 11 Dec 21 Location: State Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
PDFLibrary.LoadFromFile('D:\a0g1.pdf','');
i:=PDFLibrary.Decrypt; str:= inttostr(i); // PDFLibrary.CombineContentStreams(); // str:= PDFLibrary.GetContentStreamToString(); memo1.Text:= str; //****************************// Function Decrypt returns code 0.... |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
0 could mean that the pdf isn't encrypted.
You should try a... If PDFLibrary.EncryptionStatus > 0 Then PDFLibrary.Decrypt; ...first. |
|
Cheers,
Ingo |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store