I'll have a look.

Paulo

________________________________
From: Алексей Гуревский [mailto:[email protected]]
Sent: Friday, July 09, 2010 1:02 PM
To: [email protected]
Subject: [iText-questions] WMF file doesn't display correctly

Hi
I've got a problem with iTextSharp.

I'm using MS Chart Control in my project, it allows saving charts in EMF format.

I've used WInApi function GdipEmfToWmfBits to convert image from emf to 
placeable wmf (cause your library supports only placeable wmf),
I've attached three files in this letter, the first is valid placeable wmf, the 
second is my emf file, and the third is pdf generated using iTextSharp.

You'll see that wmf file displays incorrect in pdf.

Please help to solve this problem. May be there are some problems in WMF 
codec.....

P.S. In my opinion, such method (using WInApi function GdipEmfToWmfBits) allows 
simply inserting EMF files to PDF. So you can write your "EMF codec" only in a 
couple of lines.

private enum EmfToWmfBitsFlags
        {
            EmfToWmfBitsFlagsDefault = 0x00000000,
            EmfToWmfBitsFlagsEmbedEmf = 0x00000001,
            EmfToWmfBitsFlagsIncludePlaceable = 0x00000002,
            EmfToWmfBitsFlagsNoXORClip = 0x00000004
        }

 [DllImport("gdiplus.dll", SetLastError=true)]
        static extern int GdipEmfToWmfBits(int hEmf, int uBufferSize, byte[] 
bBuffer, int iMappingMode, EmfToWmfBitsFlags flags);
void meth() {
const int MM_ANISOTROPIC = 8;
Metafile mf = new Metafile(@"d:\1.emf");
int handle = mf.GetHenhmetafile().ToInt32();
int bufferSize = GdipEmfToWmfBits(handle, 0, null,MM_ANISOTROPIC, 
EmfToWmfBitsFlags.EmfToWmfBitsFlagsIncludePlaceable);

byte[] buf = new byte[bufferSize];
GdipEmfToWmfBits(handle, bufferSize, buf, MM_ANISOTROPIC, 
EmfToWmfBitsFlags.EmfToWmfBitsFlagsIncludePlaceable);
FileStream fs = new FileStream(@"d:\1.wmf", FileMode.Create);
 fs.Write(buf, 0, bufferSize);
 fs.Close();
}


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to