How to render the Word document contents page by page as image using DocIO?
Essential® DocIO supports rendering Word document contents page by page as images. You can save the rendered pages as raster formats (*.png, *.jpeg, *.bmp, *.tiff, *.gif, etc.) or vector formats (*.emf, *.wmf, etc.). Essential® DocIO internally uses GDI+ functionality for rendering Word document contents page by page. Hence, this feature is supported only on .NET platforms that support GDI+ functionality.
Below code snippets demonstrate how to render Word document contents page by page as images 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 image.Length - 1
image(imageIndex).Save("WordToImage_" & imageIndex.ToString() & ".png", ImageFormat.Png)
Next
The below sample demonstrates how to render Word document contents page by page as images using Essential® DocIO.
Conclusion
I hope you enjoyed learning about how to render Word document contents page by page as images using Essential® DocIO.
You can refer to our WinForms DocIO feature tour page to know about its other groundbreaking features and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsor feedback portal. We are always happy to assist you!