Can provide a pdf printing example for setting the password?

When I set a password, but the password is wrong, the file cannot be opened.
please help

Comments

  • Hi Andy,

    Which version of ReportBuilder and Delphi are you using? ReportBuilder has supported encrypted PDF exports for quite some time.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Is ReportBuilder 20.04

    There is no problem in exporting to encrypted PDF.
    But the password entered when opening the PDF is incorrect.

    ppReport_201709_PDF.DeviceType:='PDF';
    with ppReport_201709_PDF.PDFSettings do begin
    Author:='test';
    Title:='test';
    end;
    with ppReport_201709_PDF.PDFSettings.EncryptSettings do begin
    Enabled:=True;
    UserPassword := 'test';
    end;
    ppReport_201709_PDF.TextFileName:='test.PDF';
    ppReport_201709_PDF.Print;

    Since there is no example of encrypted PDF in the demo provided, can it be provided as a reference?
  • Hi Andy,

    Thanks for the information. In my tests, encryption is working correctly with code similar to yours and I am able to successfully open a password protected PDF. Below is the code I used to test. If you are still unable to get this working, please create a simple example and send it to support@digital-metaphors.com and I'll take a look at what is happening.
    uses
    ppTypes;

    procedure TForm2.Button1Click(Sender: TObject);
    begin
    ppReport1.DeviceType := dtPDF;
    ppReport1.OpenFile := True;
    ppReport1.AllowPrintToFile := True;
    ppReport1.ShowPrintDialog := False;
    ppReport1.TextFileName := 'Test.pdf';

    ppReport1.PDFSettings.Author := 'Test';
    ppReport1.PDFSettings.Title := 'Test';

    ppReport1.PDFSettings.EncryptSettings.UserPassword := 'Test';
    ppReport1.PDFSettings.EncryptSettings.Enabled := True;

    ppReport1.Print;

    end;
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • The situation remains the same, PDF cannot be opened with the correct password.
    The project file has been sent to support@digital-metaphors.com
  • Has been tested in the following environment.
    Exported PDF cannot be opened by correct password.

    Delphi 10.4.1 & RB 20.04
    Delphi 10.4 & RB 18.01
    Delphi XE & RB 20.04
  • Windows 10 Pro Chinese-T
  • Hi Andy,

    Thanks for the example and information. This issue appears to only occur when the Windows regional locale is set to a non-latin value. It likely has to do with the changed ANSI code page being used in that case.

    We will research this further and report back here once a solution is found.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • This issue will be fixed for the next version of ReportBuilder. Registered users can contact support@ for a temporary work-around.

    Note that this issue only affects certain regional locales.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.