Syncfusion Feedback


Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The Syncfusion Xamarin Word Library (DocIO) offers powerful and comprehensive APIs to convert a Word document into an image programmatically with a few lines of code without Microsoft Word or interop dependencies. It allows you to generate an entire document as images or a single page of a Word document as an image to provide the document’s preview, thumbnail, or to print it.


Key features

Fast and reliable

Convert complex Word documents into image files faster in a batch process, compared to Office automation libraries.

Partial trust environment

Convert Word documents to image files in partial trust environments like Azure and AWS.

Platform independent

This non-UI component automates the conversion of Word documents to images in .NET Framework, .NET Core, Blazor, Xamarin, and .NET MAUI applications.


Word to image options

Specific pages

Convert a specific page in a Word document into an image.

Specific range of pages

Convert the specified range of pages in a Word document into images.

Font substitution

The built-in font substitution event allows users to choose alternate fonts from the device or upload the required fonts with a few lines of code.


Convert the entire document to images

  1. using Syncfusion.DocIO;
  2. using Syncfusion.DocIO.DLS;
  3. using Syncfusion.DocIORenderer;
  4.  
  5. //Load file stream into Word document.
  6. using (WordDocument wordDocument = new WordDocument(wordDocumentStream, FormatType.Automatic))
  7. {
  8. //Create a new instance of DocIORenderer class.
  9. using (DocIORenderer render = new DocIORenderer())
  10. {
  11. //Convert the entire Word document to images.
  12. Stream[] imageStreams = wordDocument.RenderAsImages();
  13. //Save the memory stream as file.
  14. for (int i = 0; i < imageStreams.Length; i++)
  15. Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("WordToImage_" + i + ".jpeg", "image/jpeg", imageStreams[i] as MemoryStream);
  16. }
  17. }

Convert first page of a document to an image

  1. using Syncfusion.DocIO;
  2. using Syncfusion.DocIO.DLS;
  3. using Syncfusion.DocIORenderer;
  4.  
  5. using (WordDocument wordDocument = new WordDocument(wordDocumentStream, FormatType.Automatic))
  6. {
  7. using (DocIORenderer render = new DocIORenderer())
  8. {
  9. //Convert the first page of the Word document into an image.
  10. Stream imageStream = wordDocument.RenderAsImages(0, ExportImageFormat.Jpeg);
  11. Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("WordToImage.jpeg", "image/jpeg", imageStream as MemoryStream);
  12. }
  13. }

Convert a specific range of pages to images

  1. using Syncfusion.DocIO;
  2. using Syncfusion.DocIO.DLS;
  3. using Syncfusion.DocIORenderer;
  4.  
  5. using (WordDocument wordDocument = new WordDocument(wordDocumentStream, FormatType.Automatic))
  6. {
  7. using (DocIORenderer render = new DocIORenderer())
  8. {
  9. //Convert a specific range of pages in Word document to images.
  10. Stream[] imageStreams = wordDocument.RenderAsImages(1, 2);
  11. for (int i = 0; i < imageStreams.Length; i++)
  12. Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("WordToImage_" + i + ".jpeg", "image/jpeg", imageStreams[i] as MemoryStream);
  13. }
  14. }

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.

Scroll up icon
Chat with us