How detect the Start and the End of PDF Export

hi, everyone

I need detect the start and the end of PDF Export, I need to save the PDF file to Database but I dont know how I could handle this events.

TFrxPDFExport component has two event: BeginExport and BeforeExport, but it does not has an AfterExport or EndExport event handler.

Could you help me please?

Best Regards

Comments

  • gpigpi
    edited 10:18AM
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, frxClass, frxExportPDF, frxPreview, frxDsgnIntf, Menus;
    
    type
      TForm1 = class(TForm)
        frxReport1: TfrxReport;
        frxPDFExport1: TfrxPDFExport;
        SaveDialog1: TSaveDialog;
        procedure FormCreate(Sender: TObject);
        procedure frxReport1Preview(Sender: TObject);
        procedure PDFExport(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    
    {$R *.dfm}
    
    procedure TForm1.PDFExport(Sender: TObject);
    begin
         if SaveDialog1.Execute then
           begin
             //frxPDFExport1.FileName:=SaveDialog1.FileName;
             //TfrxPreview(frxReport1.Preview).Export(frxPDFExport1);
             //create and save the PDF file to Database here
           end;
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
         frxReport1.ShowReport;
    end;
    
    procedure TForm1.frxReport1Preview(Sender: TObject);
    var i, j, mi: integer;
    begin
           TfrxPreviewForm(frxReport1.PreviewForm).PdfB.OnClick:=PDFExport;
           for i := 0 to frxExportFilters.Count - 1 do
             begin
               if TfrxCustomExportFilter(frxExportFilters[i].Filter).ClassName = 'TfrxPDFExport' then
                 mi:=i;
             end;
           TfrxPreviewForm(frxReport1.PreviewForm).ExportPopup.Items[mi + 2].OnClick:=PDFExport;
           for i:=0 to TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items.Count-1 do
             begin
               if TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].Caption=TfrxPreviewForm(frxReport1.PreviewForm).SaveB.Hint then
                 begin
                   for j:=0 to TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].Count-1 do
                     if TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i][j].Caption=TfrxPreviewForm(frxReport1.PreviewForm).ExportPopup.Items[mi + 2].Caption then
                        TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i][j].OnClick:=PDFExport;
                 end;
               if TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].Caption=TfrxPreviewForm(frxReport1.PreviewForm).PdfB.Hint then
                 TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].OnClick:=PDFExport;
             end;
    end;
    
    end.
    

Leave a Comment