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 2:22AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.