robertonicchi
Jun 18 2004, 08:49 AM
I'm trying to translate the following code from Fr2 to Fr3
The code uses WPDF to save a fastreport output in PDF format
But i can't find (of course) the EMFPages property in FR3
thank you a lot for any help
Roberto
P.S. Congratulation for the new FR version. I like it !!
uses Windows, Classes, FR_Class, WPPDFR1, WPPDFR2;
procedure generate_pdf(report:Tfrreport;pdf_file:string);
implementation
procedure generate_pdf(report:Tfrreport;pdf_file:string);
Var
i: integer;
wpdf:TWPPDFPRINTER;
begin
wpdf:=TWPPDFPRINTER.create(nil);
try
wpdf.GraphicDriverMode:=wpdf.GraphicDriverMode + [wpsetcanvasresolution];
With report do
begin
if EMFPages.Count <> 0 then
begin
wPDF.filename:=pdf_file;
wPDF.BeginDoc;
for i := 0 to EMFPages.Count - 1 do
begin
EMFPages.Pages[i].Visible := True;
wPDF.StartPage(
MulDiv(EMFPages[i].pgwidth,72,72),
MulDiv(EMFPages[i].pgheight,72,72),
72, 72,0);
EMFPages.Draw(i, wPDF.canvas, Rect(0, 0, EMFPages[i].pgwidth,EMFPages[i].pgheight));
wPdf.EndPage;
end;
wPDF.EndDoc;
end;
end;
finally
wpdf.free;
end;
end;
AlexTZ
Jun 19 2004, 03:54 PM
Use TfrxReport.PreviewPages:
procedure TfrxPreviewPages.DrawPage(Index: Integer; Canvas: TCanvas;
ScaleX, ScaleY, OffsetX, OffsetY: Extended);
var
Page: TfrxReportPage;
Page := frxReport1.PreviewPages.Page[i];
{ sizes are in Page.Width, Page.Height }
frxReport1.PreviewPages.DrawPage(i, wPDF.canvas, 1, 1, 0, 0);
robertonicchi
Jun 21 2004, 10:11 AM
Thank you.
It works fine.
For who is interested in convert FR3 reports in PDF using wPDF this is the code that works for me:
procedure fr3_2_pdf(report:Tfrxreport;pdf_file:string);
Var
i: integer;
wpdf:TWPPDFPRINTER;
Pg: TfrxReportPage;
begin
wpdf:=TWPPDFPRINTER.create(nil);
try
With report do
begin
if previewpages.Count <> 0 then
begin
wPDF.filename:=pdf_file;
wPDF.BeginDoc;
for i := 0 to previewpages.Count - 1 do
begin
Pg:=PreviewPages.Page[i];
wPDF.StartPage(MulDiv(trunc(pg.width),72,72),
MulDiv(trunc(pg.height),72,72),
72, 72,0);
PreviewPages.DrawPage(i, wPDF.canvas, 1, 1, 0, 0);
wPdf.EndPage;
end;
wPDF.EndDoc;
end;
end;
finally
wpdf.free;
end;
end;
Man
Jun 22 2004, 09:33 AM

Hi
I'm New In Fast Report
I Want To Translate FastReport 2.52 File To FastReport 3.0 File
How Can I Make It If It Possiple.
Man
AlexTZ
Jun 22 2004, 01:24 PM
Open the designer, File|Save as..., select "FR3 report" in the "file type" drop-down list.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.