Translatin some code from Fr2 to Fr3
robertonicchi
ITALY
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.Visible := True;
wPDF.StartPage(
MulDiv(EMFPages.pgwidth,72,72),
MulDiv(EMFPages.pgheight,72,72),
72, 72,0);
EMFPages.Draw(i, wPDF.canvas, Rect(0, 0, EMFPages.pgwidth,EMFPages.pgheight));
wPdf.EndPage;
end;
wPDF.EndDoc;
end;
end;
finally
wpdf.free;
end;
end;
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.Visible := True;
wPDF.StartPage(
MulDiv(EMFPages.pgwidth,72,72),
MulDiv(EMFPages.pgheight,72,72),
72, 72,0);
EMFPages.Draw(i, wPDF.canvas, Rect(0, 0, EMFPages.pgwidth,EMFPages.pgheight));
wPdf.EndPage;
end;
wPDF.EndDoc;
end;
end;
finally
wpdf.free;
end;
end;
Comments
procedure TfrxPreviewPages.DrawPage(Index: Integer; Canvas: TCanvas;
ScaleX, ScaleY, OffsetX, OffsetY: Extended);
var
Page: TfrxReportPage;
Page := frxReport1.PreviewPages.Page;
{ sizes are in Page.Width, Page.Height }
frxReport1.PreviewPages.DrawPage(i, wPDF.canvas, 1, 1, 0, 0);
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;
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;
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