You are not logged in.
Pages: 1
Metafile generated by TeeChart is not rendered correctly.
When I render it with bitmap, I get the following image:
But in pdf it is completely wrong:
This is my code:
var
PdfDoc: TPdfDocumentGDI;
PdfPage: TPdfPage;
ChartMetafile: TMetafile;
bmp: TBitmap;
begin
ChartMetafile := nil;
bmp := nil;
PdfDoc := TPdfDocumentGDI.Create(False, 0, true, nil);
try
PdfPage := PdfDoc.AddPage;
PdfPage.PageLandscape := true;
ChartMetafile := Chart.TeeCreateMetafile(False, Rect(0,0, PdfPage.PageWidth, PdfPage.PageHeight));
bmp := TBitmap.Create;
bmp.Width := ChartMetafile.Width;
bmp.Height := ChartMetafile.Height;
bmp.Canvas.Draw(0, 0, ChartMetafile);
bmp.SaveToFile('c:\temp\test.bmp');
PdfDoc.VCLCanvas.Draw(0, 0, ChartMetafile);
PdfDoc.SaveToFile('c:\temp\test.pdf');
finally
PdfDoc.Free;
ChartMetafile.Free;
end;
I tried it with RenderMetafile also, it gave the same result. What can be the problem?
Last edited by chachora (2016-01-26 14:28:05)
Offline
Are you using the latest revision of the library?
Current is 1.18.2306.
We use this in production, with no problem - but not from TeeChart as source.
There is even a dedicated test very close to this in our regression tests - see TestSQL3.pdf as generated by TestSQL3.exe.
Offline
I've downloaded it from GitHub, version is 1.18, but there is not build number mentioined.
Offline
I downloaded the latest mORMot, but still the issue remains.
Offline
I have tried to export with different settings and it worked!
Finally, I found the settings of TeeChart when the problem starts:
1. GDI+ shall be selected as a Render
2. 3D mode shall be enabled
3. Any series have to be on the chart.
When I changed the render to GDI or disable 3D mode, library works just fine.
Emf files are below:
1. GDI and 3D
3d_gdi.emf
2. GDI+ and 3D
3d_gdi+.emf
Offline
Offline
So, it means that TeeChart exports to EMF file with wrong format when GDI+ and 3D enabled in the settings?
Offline
I use TeeChart and print them on PDF with SynPDF
MyChart.SaveToMetafileEnh(Filename);
saves a valid EMF file.
Offline
Pages: 1