diff options
author | Jean-Marc Levecque <jean-marc.levecque@jmlesite.fr> | 2012-08-28 20:59:40 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-08-28 20:59:40 +0100 |
commit | 860d4c70c8bf38e5d77abd8fa2292371b32036e1 (patch) | |
tree | 18f03d348de5dddcdc9bf10d1f2023f7298cdce2 /src/reportengine | |
parent | a380f0a3fbaa8c62382a86b1ebf9583c1688c12c (diff) | |
download | fpGUI-860d4c70c8bf38e5d77abd8fa2292371b32036e1.tar.xz |
pdf: remove code duplication and use report.printpdf() instead
Diffstat (limited to 'src/reportengine')
-rw-r--r-- | src/reportengine/u_visu.pas | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/reportengine/u_visu.pas b/src/reportengine/u_visu.pas index 99acca0a..c3c36404 100644 --- a/src/reportengine/u_visu.pas +++ b/src/reportengine/u_visu.pas @@ -112,7 +112,6 @@ implementation uses U_Command, - U_Pdf, U_ReportImages; procedure TF_Visu.FormShow(Sender: TObject); @@ -181,39 +180,8 @@ begin end; procedure TF_Visu.Bt_PdfClick(Sender: TObject); -var - Fd_SavePdf: TfpgFileDialog; - PdfFile: string; - PdfFileStream: TFileStream; begin - Fd_SavePdf := TfpgFileDialog.Create(nil); - Fd_SavePdf.InitialDir := fpgExtractFilePath(ParamStr(0)); - Fd_SavePdf.Filter := 'PDF Documents |*.pdf'; - Fd_SavePdf.FileName := FReport.DefaultFile; - try - if Fd_SavePdf.RunSaveFile then - begin - PdfFile := Fd_SavePdf.FileName; - if Lowercase(fpgExtractFileExt(PdfFile)) <> '.pdf' then - PdfFile := PdfFile + '.pdf'; - Document := TPdfDocument.CreateDocument; - with Document do - begin - PdfFileStream := TFileStream.Create(PdfFile, fmCreate); - WriteDocument(PdfFileStream); - PdfFileStream.Free; - Free; - end; - {$ifdef linux} - fpgOpenURL(PdfFile); - {$endif} - {$ifdef win32} - ShellExecute(0, PChar('OPEN'), PChar(PdfFile), PChar(''), PChar(''), 1); - {$endif} - end; - finally - Fd_SavePdf.Free; - end; + FReport.PrintPdf; end; procedure TF_Visu.Bt_FirstPageClick(Sender: TObject); |