Export to PDF with password doesn't work

Hallo,

I have Delphi 2007 and Fast Report 4.15.13 (last current version) Enterprise edition.

My source code is like this:

PDFExport := TfrxPDFExport.Create(nil);

PDFExport.UserPassword := UserPass;
PDFExport.OwnerPassword := OwnerPass;
PDFExport.ProtectionFlags := [ePrint];
PDFExport.Stream := ReportStream;

Report.Export(PDFExport);

etc.

UserPass and OwnerPass are string variables (AnsiString). This works fine in Delphi 7 and FastReport 4.15 (release version from 4.10.2013). But in Delphi 2007 and Fast Report 4.15.13 (last current version) PDF still reports error message: incorrect password. Where's the problem ?

Thanx for your help.

Comments

  • edited 5:41AM
    Resolved !

    Everythink is OK instead of attachment of e-mail using Indy components.

    In Delphi 7 I have this code:

    var
    MemAttach: TIdAttachmentMemory;
    begin
    try
    MemAttach := TIdAttachmentMemory.Create(MailMessage.MessageParts, sSource);

    etc.

    sSource is string variable. Everythink is OK in Delphi 7.

    But in Delphi 2007 PDF file with password is corrupted - incorrect password. Maybe some encoding ? Maybe new version of Indy components - I have older version in Delphi 7 and new version in Delphi 2007.

    Correct code in Delphi 2007:

    sSource variable (string in Delphi 7) is now TStream and appropriate constructor of TIdAttachmentMemory is used.

    Sorry for wasted your time.

    Best regards !

    Marek

Leave a Comment