Hey;
I'm using the Document Imagine API from Office 2003. I need to get
away from the proprietary MDI/TIFF formats it produces. It looked
pretty simple, but it's giving me grief when I try to convert the
IPictureDisp object it creates into an Image for use with .NET:
-----begin source (C#)-----
//Take page 1
MODI.Image page_1 = (MODI.Image) doc.Images[0];
//Convert it to System.Drawing. Image
//None of these methods work
System.Drawing. Image pdf_image =
System.Drawing. Image.FromFile( "a.jpg");
//Method 1
//pdf_image =
Microsoft.Visua lBasic.Compatib ility.VB6.Suppo rt.IPictureDisp ToImage(page_1. Picture);
//Method 2 (Shouldn't work -- the picture property is
a metafile)
//System.IntPtr sdf = new
System.IntPtr(p age_1.Picture.H andle);
//pdf_image = Bitmap.FromHbit map(sdf);
//Method 3
//pdf_image =
AxImageConverte r.IPictureToIma ge((stdole.StdP icture) page_1.Picture) ;
//Method 4
//Graphics g =
System.Drawing. Graphics.FromIm age(pdf_image);
//IntPtr gp = g.GetHdc();
//page_1.Picture. Render((int)gp, 0, 0,
page_1.Picture. Width, page_1.Picture. Height, 0, 0,
page_1.Picture. Width, page_1.Picture. Height, (System.IntPtr) null);
//g.DrawImage(pdf _image, new PointF(0.0F,0.0 F));
//Works with thumbnail :-S. BLAH!
pdf_image =
AxImageConverte r.IPictureToIma ge((stdole.StdP icture)page_1.g et_Thumbnail(Mi THUMBNAIL_SIZE. miTHUMB_SIZE_LA RGE));
-----end source------
The error I get is "Element not found." (Same as
this post:
http://groups.google.com/group/micro...ev/browse_thre...)
So, I can only conclude, MODI's StdPicture object is corrupt for
Image.Picture, (Though
it works with *something,* i.e. the VB6 picture box, and
Image.get_Thumb nail works like a charm). Has anyone
gotten this to work in .NET?
SigmaX