Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I need to convert a doc or docx file into a image file which i can show in a picture box. I don't know how to do that. Somebody please help.
Posted

use Doc to Image Converter .

this link :

http://download.cnet.com/Doc-to-Image-Converter/3000-18483_4-10355688.html[^]


Good Luck.
 
Share this answer
 
There are different ways you can do it:

1- Use print screen of the doc file and use it as jpeg.
2- Use a third party tool to do it
3- Covert the doc file to pdf and then convert it to jpeg file
4- use Print 2 image printer driver to save the doc file to jpeg
http://www.imecominc.com/products/printer-driver/outputs/jpg/[^]

Make you choice....;-)
 
Share this answer
 
Comments
prthghosh999 13-Jul-13 4:37am    
is there any way to change the document into byte array and then it to a image file...
Pradeep Shukla 13-Jul-13 12:35pm    
you can do that using:

byte[] bytes = System.IO.File.ReadAllBytes(wordDocumentFilePath)

afterwards the byte array can be converted to jpeg..
prthghosh999 13-Jul-13 13:53pm    
i've used this code...
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wordDoc = new Microsoft.Office.Interop.Word.Document();

object falseVal = false;


string fileName = @"D:\document.doc";
FLimage.PostedFile.SaveAs(Server.MapPath("~/temp") + "/test.docx");

System.IO.MemoryStream ms = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(Server.MapPath("~/temp") + "/test.docx"));
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
img.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);


but got an error "parameter is not valid" on the line
....Image.FromStream(ms);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900