#1 2011-10-18 18:57:23

kartus
Member
Registered: 2011-10-18
Posts: 2

Trouble with VCLCanvas loading metafile from teechart

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

Offline

#2 2011-10-18 19:35:17

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Trouble with VCLCanvas loading metafile from teechart

First of all, did you try the latest version of the SynPDF library - from http://synopse.info/fossil ?

Could you try to save the metafile into a file with Delphi 7 and Delphi 2009, then try to render it on both versions of SynPDF?

It will show up what is wrong.

If you can, post a link to the metafile so that I may reproduce it.

I found out Delphi 2009 not to be a stable platform for all purposes.
May be there is something to fix for this version, but I do not have this compiler installed.

Thanks!

Offline

#3 2011-10-18 21:52:44

kartus
Member
Registered: 2011-10-18
Posts: 2

Re: Trouble with VCLCanvas loading metafile from teechart

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

Offline

#4 2011-11-23 08:17:31

kipa
Member
Registered: 2011-11-23
Posts: 1

Re: Trouble with VCLCanvas loading metafile from teechart

I have same problems with rendering meta to pdf (dotted line is not drawn).

P.S. IDE CodeGear™ Delphi® 2007 for Win32®  Version 11

P.S. Sorry for my English smile

Offline

Board footer

Powered by FluxBB