Category / Section
How to render the Word document contents page by page as image using Essential DocIO?
2 mins read
Essential DocIO supports to render the Word document contents page by page as images. You can save rendered page as raster (*.png, *.jpeg, *.bmp,*.tiff, *.gif, etc) or vector formats (*.emf, *.wmf, etc). Essential DocIO internally uses GDI+ functionality for rendering the Word document contents page by page. Hence this feature will be supported only in the .NET platforms which supports GDI+ functionality.
Below code snippets demonstrates how to render the Word document contents page by page as image using Essential DocIO.
C#:
// Loads the Word Document WordDocument doc = new WordDocument(@"..\..\Template.docx"); // Converts the Word Document into images Image[] image = doc.RenderAsImages(ImageType.Metafile); //Saves the converted images in png file format to the file system for (int imageIndex = 0; imageIndex < image.Length; imageIndex++) { image[imageIndex].Save("WordToImage_"+imageIndex.ToString()+".png", ImageFormat.Png); }
VB:
'Loads the Word Document Dim doc As New WordDocument("..\..\Template.docx") 'Converts the Word Document into images Dim image As Image() = doc.RenderAsImages(ImageType.Metafile) 'Saves the converted images in png file format to the file system For imageIndex As Integer = 0 To images.Length - 1 images(imageIndex).Save("WordToImage_" & imageIndex.ToString() & ".png",ImageFormat.Png) Next
The below sample demonstrates on how to render the Word document contents page by page as images using Essential DocIO