You are not logged in.
Pages: 1
Hello,
I need to create a pdf file from the emf image. The code below can work well to some emf images, but other emf images can't work. The emf file can be download from http://url.cn/FBFSBe .
thanks
procedure TForm1.Button2Click(Sender: TObject);
const
OutputFileName = 'c:\1.pdf';
InputFileName = 'C:\tmpemf\3.emf';
var
PdfDoc : TPDFDocumentGDI;
Emf : TMetafile;
R : TRect;
Gdip : TGDIPlusFull;
begin
Emf := TMetafile.Create();
Emf.LoadFromFile(InputFileName);
Gdip := TGDIPlusFull.Create;
PdfDoc := TPdfDocumentGDI.Create;
PdfDoc.CompressionMethod := cmFlateDecode;
PdfDoc.DefaultPaperSize := psA4;
PdfDoc.AddPage;
R.Left := 0;
R.Top := 0;
R.Bottom := Emf.Height;
R.Right := Emf.Width;
Gdip.DrawAntiAliased(Emf, PdfDoc.VCLCanvas.Handle, R, smAntiAlias, trhClearTypeGridFit);
PdfDoc.SaveToFile(OutputFileName);
PdfDoc.Free();
FreeAndNil(Emf);
end;
Offline
AFAIK pdf generation just work as expected (tested with latest "unstable" version from our source code repository).
There was an issue with GDI+ rendering.
Should be fixed now by http://synopse.info/fossil/info/88816ae3ce
Thanks for the feedback.
Offline
Pages: 1