Print Page | Close Window

ReplaceTag

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=1062
Printed Date: 23 Jun 25 at 9:32AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: ReplaceTag
Posted By: dejan61
Subject: ReplaceTag
Date Posted: 16 Apr 09 at 5:32AM
ReplaceTag doestn work.
I tried this with many diferent documents. It never worked.
I must replace one text with another. Perhaps is the ReplaceTag wrong function to do that. I'm using Delphi 6
 
   LoadFromFile('file name') --> returns 1
   ReplaceTag('something','something else') --> returns 0 although string  
                                                      'something' exists in source document.
 
Please help !
 
 
 
 



Replies:
Posted By: Ingo
Date Posted: 16 Apr 09 at 6:05AM
Hi!

What you wanna do you can do with ReplaceTag but ...
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 encrypt the document before you're using ReplaceTag:
If QP.Encrypted > 0 Then
   QP.Unencrypt;

It should be clear that after ReplaceTag you've done a save and new load?

Cheers, Ingo



Posted By: dejan61
Date Posted: 16 Apr 09 at 6:55AM
I can't found "Encrypted" and "Unecrypt"
I found "EncriptionStatus" and "Decrypt". Is that the same ?
 
MfG, Dejan
 
 


Posted By: Ingo
Date Posted: 16 Apr 09 at 7:36AM
Hi Dejan!

You're "eagle eye" ;-)
It seems to me that Debenu has forgotten these important two functions while rewriting the new documentation. They are reading here, too - so i'm pretty sure that there's a new documentation available soon.

Here's a part of the old documentation:

Encrypted
=========

Description
-----------
Determines the encryption status of the selected document.

Definition
----------
Function Encrypted() As Long

Parameters
----------
N/A

Returns
-------
0 The selected document is not encrypted.
1 The document is encrypted with Adobe "Standard" encryption.
2 The document is encrypted with an unknown encryption


Unencrypt
=========

Description
-----------
Attempts to decrypt the selected document. If the document is encrypted and the user password has been set, then the SetPassword  function must be called before this function.

Definition
----------
Function Unencrypt() As Long

Parameters
----------
N/A

Returns
-------
0 The document could not be decrypted.
1 The document was decrypted successfully.


Cheers, Ingo


Posted By: Rowan
Date Posted: 16 Apr 09 at 7:47AM
Hi Guys,

Sorry for the confusion -- but the two functions, Encrypted and Unencrypt, were renamed in version 7.12 to be http://www.quickpdflibrary.com/help/quickpdf/EncryptionStatus.php - EncryptionStatus and http://www.quickpdflibrary.com/help/quickpdf/Decrypt.php - Decrypt . The new function names provide a more accurate description of the functionality.

A full list of renamed functions can be found here:

http://www.quickpdflibrary.com/help/quickpdf/RenamedFunctions.php - http://www.quickpdflibrary.com/help/quickpdf/RenamedFunctions.php

Cheers,
- Rowan.


Posted By: dejan61
Date Posted: 17 Apr 09 at 2:52AM
This doesn't work:
 
with PDFLibrary1 do begin
   LoadFromFile('c:\test.pdf');
   if EncryptionStatus > 0 then begin
         Decrypt;
   end;
   ReplaceTag('R','P');
   SaveToFile('c:\changed.pdf');
end;
file is not encripted (EncriptStatus = 0)
 
What am I doing wrong ?
 
I must replace some variables in PDF file with data from database.
Is there another way to do it ?


Posted By: Ingo
Date Posted: 17 Apr 09 at 3:25AM
Hi!

What do you mean with "replace variables"?
If you want to change values from formfields then you should use the functions from the section "form fields".

Cheers, Ingo


Posted By: dejan61
Date Posted: 17 Apr 09 at 6:38AM

I must insert data from databes into pdf document:

Tekst in PDF document:    Name: <Name>
 
The program must replace the text <Name>  with the data from database.
 
Result will be:  Name: Dejan
 
How can I do this the other way ?
 
 


Posted By: Ingo
Date Posted: 17 Apr 09 at 7:18AM
Hi Dejan!

What you wanna do is like closing the eyes to the options the pdf-specs are offering to you ;-)
You should create a normal pdf-template with formfields. This formfields you can fill then without any problem and after you've flatten the values they'll stay in the pdf.

So my advice: Forget the way you wanna go and do it with formfields. That's the better (standard) way.

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