Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Feb 05, 2014 7:26 pm

I´m using the free version of the spire.doc.

I´m trying to convert a html file to image, and when i go open the file, don´t have the option html for fila format.

see my code below:

string file = Server.MapPath("~/example_spire_doc.html");
string filesave = Server.MapPath("~/example_spire_doc.png");

System.IO.File.WriteAllText(file, consulta.CONSULTA);

Document doc = new Document(file,FileFormat.Docx2013);

//doc.LoadFromStream(ms, FileFormat.Auto);

Image img = doc.SaveToImages(0, Spire.Doc.Documents.ImageType.Png);

img.Save(filesave);

thanks.

borgues
 
Posts: 1
Joined: Wed Feb 05, 2014 6:28 pm

Thu Feb 06, 2014 2:38 am

Hello,

Thanks for your inquiry.
Please refer the following method to convert html to image.
Code: Select all
Document document = new Document();
document.LoadFromFile(@"D:\test.html", FileFormat.Html, XHTMLValidationType.None);
Image image = document.SaveToImages(0, ImageType.Bitmap);
image.Save("Sample.png", ImageFormat.Png);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Feb 11, 2014 9:40 am

Hello,

Have you tried the method? Has your issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc