Garann Means
11/23/2004 4:56:00 PM
Hi,
I'm trying to turn a series of images into metafiles for use as PowerPoint
AutoShapes. I've tried doing this with a simple ASP.NET application that
takes an uploaded image and spits out a .WMF file, but the files it creates
can only be opened by certain image viewers, and not by PowerPoint. Is there
some property I need to set, or something I need to add? My code is below:
Dim fileName As String = getFilename(Request.Files(0).FileName)
Request.Files(0).SaveAs(Server.MapPath(fileName))
Dim img As Image = Image.FromFile(Server.MapPath(fileName))
Dim g As Graphics = Graphics.FromImage(img)
Dim hdc As IntPtr = g.GetHdc()
Dim m As Metafile = New Metafile(Server.MapPath("newFile.wmf"),
hdc, EmfType.EmfOnly)
g.ReleaseHdc(hdc)
g.Dispose()
g = Graphics.FromImage(m)
g.DrawImage(img, 0, 0)
g.Dispose()
m.Dispose()
Thanks for any help,
Garann