#1 Re: PDF Engine » Trouble with VCLCanvas loading metafile from teechart » 2011-10-18 21:52:44

I tried with the last version from the repo and still have the same trouble.
Please find in the following link an emf file generated from delphi 2009 which reproduce the issue in delphi 7 and 2009:
http://min.us/lbd3q0xDMOC02J

Thanks

#2 PDF Engine » Trouble with VCLCanvas loading metafile from teechart » 2011-10-18 18:57:23

kartus
Replies: 3

Hello everyone,

I wrote this code that work good on delphi 7

var
  Meta: TMetafile;
  PDFPage: TPdfPage;
  i: integer;
  bmp      : TBitmap;
begin
  chart1.BevelOuter:= bvNone;
  for i:= 0 to chart1.SeriesCount - 1 do
    chart1.Series[i].FillSampleValues(1000);

 with TPdfDocumentGDI.Create do
  begin
    PDFPage:= AddPage;
    PdfPage.PageLandscape:= false;
    PdfPage.PageWidth:= 595;
    PdfPage.PageHeight:= 842;
    chart1.Width:= PDFPage.PageWidth;
    chart1.Height:= PDFPage.PageHeight;

    Meta:= Chart1.TeeCreateMetafile(true, Rect(0, 0, PDFPage.PageWidth, PDFPage.PageHeight));
    VCLCanvas.StretchDraw(Rect(0, 0, PDFPage.PageWidth, PDFPage.PageHeight), Meta);

    bmp      := TBitmap.Create;
    bmp.Width := PdfPage.PageWidth;
    bmp.Height:= PdfPage.PageHeight;
    bmp.Canvas.StretchDraw(Rect(0, 0, PDFPage.PageWidth, PDFPage.PageHeight), Meta);

    SaveToFile('c:\test.pdf');
    bmp.SaveToFile('c:\test.bmp');

    Meta.Free;
    bmp.Free;
    Free;
  end;
end;

I compiled the same code on delphi 2009 and i have trouble on pdf rendering.
The generated pdf file is incomplete: only some part of the metafile are drawn.
The Bmp file is ok.

Thanks for your help

Board footer

Powered by FluxBB