#2 PDF Engine » Problem with TMetafile to PDF » 2016-05-27 13:06:44

Mielofon
Replies: 2

I have problem with rendering EMF file.

EMF in Paint:
-pJx_r11p9e61-j__S4STXZb_ju5cgzMO6-uLZZMx88?size=2048x1536&size_mode=3

I tried three different ways (+ 4th TMetafile to TBitmap ) render TMetafile to PDF:

1. pdf.VCLCanvas.Draw

    
    pdf.VCLCanvas.Draw(10, 100, metafile);

   
very bad result

QRVj93D12v3eK1_1kGll8z1ntoJ8ZpYejF5T7sHF2J0?size=2048x1536&size_mode=3

2. GDI+ DrawEmfGdip

    
    DrawEmfGdip(pdf.VCLCanvas.Handle, metafile, r, True);

   
It is much better, but there are artifacts:
KgzCEwqYIgRRlK--AllY3oJCCR_yaMXiMrccHuay2uc?size=2048x1536&size_mode=3

3. pdf.Canvas.RenderMetaFile

    
    pdf.Canvas.RenderMetaFile(metafile, 1, 1, 10, 100);

   
bad result:
gKTdAoRwJtv6mTXRcrf9NB8LTkmi2f7SvkGtLGof0XI?size=2048x1536&size_mode=3

and
4. TMetafile -> TBitmap and VCLCanvas.Draw

    
    bmp.Canvas.Draw(0,0, metafile);
    pdf.VCLCanvas.Draw(10, 100, bmp);

   
this is good result
I6135vWk7KcrDA62veftzpg1uZtSacHpShPWEr0L52w?size=2048x1536&size_mode=3

but it is raster format and we can't copy text from a PDF for example.

What method is to use and how to except errors?

https://dl.dropboxusercontent.com/u/209 … Unit10.pas
https://dl.dropboxusercontent.com/u/209620/PDF/aa.emf
https://dl.dropboxusercontent.com/u/209 … df_emf.pdf

Board footer

Powered by FluxBB