How to set a different password for each PDF file
Hello,
Each employee have his password. I would like to set a unique password
per PDF file.
In the OnGetFileSuffixe, I set the SuffixeValue and it work fine. And I
set the UserPassword too and it work fine, but it doesn't work properly
only for the first generated file.
I tried to put de UserPassword initialization in the OnFileDeviceCreate
but the pipelines are not opened.
Do you have a solution ?
procedure Croup1OnGetFileSuffix(var SuffixValue: String);
var
lPDFDevice: TppPDFDevice;
begin
lPDFDevice := TppPDFDevice(Report.FileDevice);
lPDFDevice.PDFSettings.EncryptSettings.UserPassword :=
Employee['Password'];
SuffixValue := Employee['Number'];
end;
Thank you !
Philippe
Each employee have his password. I would like to set a unique password
per PDF file.
In the OnGetFileSuffixe, I set the SuffixeValue and it work fine. And I
set the UserPassword too and it work fine, but it doesn't work properly
only for the first generated file.
I tried to put de UserPassword initialization in the OnFileDeviceCreate
but the pipelines are not opened.
Do you have a solution ?
procedure Croup1OnGetFileSuffix(var SuffixValue: String);
var
lPDFDevice: TppPDFDevice;
begin
lPDFDevice := TppPDFDevice(Report.FileDevice);
lPDFDevice.PDFSettings.EncryptSettings.UserPassword :=
Employee['Password'];
SuffixValue := Employee['Number'];
end;
Thank you !
Philippe
This discussion has been closed.
Comments
This is a timing issue for the first group. When the first
OnGetFileSuffix event fires, the report has already begun generating to
PDF and therefore it is not possible to alter its settings at that time.
As you have guessed, the initial PDF settings need to be set before the
report begins generating. You can try using the AfterOpenDataPipelines
event to get the initial password value before report begins generating
however this may still be too late. If so, you will need to open the
pipeline manually and gather the data needed in an earlier event or in
Delphi before calling Report.Print.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com