We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word to JPEG Converter | Save Word Pages as JPEG Images (C# .NET)

Aspose.Words for .NET API can be used to convert Word files (such as DOCX, DOC, RTF, ODT, XML etc.) to sets of high-quality JPEG images. This tool can perform high fidelity Word to JPEG conversion offline inside your own local computer without the need of internet. This Word to JPEG conversion tool ensures Data Security because you do not need to upload your confidential MS Word or OpenOffice or Libre Office word processing documents anywhere for the conversion process to remotely take place. There is no file size limit of source Word document that you can convert to JPEG images to. The only limit is the amount of memory (RAM) available in your machine. Word to JPG conversion is just one of the many features that Aspose.Words offers.

Convert all Pages in Word DOCX Document to separate JPEG or .JPG Image Files

You can use the following C# code of Aspose.Words for .NET API to convert all pages in Word DOCX Document to separate JPEG or .jpg image files:

// Locally Load Word DOCX document from File or Memory Stream
Document doc = new Document(@"C:\Temp\word.docx");
// ImageSaveOptions Class allows to specify additional options when converting Word Pages or Shapes to JPG Images
ImageSaveOptions jpeg_Image_Save_Options = new ImageSaveOptions(SaveFormat.Jpeg);
// Lets convert entire Word file to JPEG Images
PageRange page_Range = new PageRange(0, doc.PageCount - 1);
jpeg_Image_Save_Options.PageSet = new PageSet(page_Range);
jpeg_Image_Save_Options.PageSavingCallback = new Word_To_JPEG_Images_Converter();
// Instruct Aspose.Words to start DOCX to JPEG Conversion process
doc.Save(@"C:\Temp\docx to.jpeg", jpeg_Image_Save_Options);

private class Word_To_JPEG_Images_Converter : IPageSavingCallback
{
    public void PageSaving(PageSavingArgs args)
    {
        args.PageFileName = string.Format(@"C:\Temp\JPEG_Image_{0}.jpg", args.PageIndex);
    }
}

To learn what other OpenOffice Writer or MS Word file formats you can use this tool to perform mass conversion to, please refer to: File Formats Supported by Aspose.Words for .NET

How to Convert First Page of DOC or ODT Word File to a JPG Image File?

  • Use Document Class to load the DOC or ODT file that you want to convert from File System or Memory Stream
  • Select JPEG as the image format that you want to convert your DOC or ODT file to.
  • Call appropriate Document.Save Method overload to start Word DOC to JPEG conversion
Document doc = new Document(@"C:\Temp\word.doc"); // or use .odt file extension
ImageSaveOptions jpeg_Image_Save_Options = new ImageSaveOptions(SaveFormat.Jpeg);
jpeg_Image_Save_Options.JpegQuality = 100;
doc.Save(@"C:\Temp\doc to.jpg", jpeg_Image_Save_Options);

Convert all Pages of Word ODT File to Set of JPEG Image Streams

You can use the following C# code of Aspose.Words for .NET library or SDK to convert all Pages of Word ODT file to JPEG streams in memory:

Document odt = new Document(@"C:\Temp\word.odt");

ImageSaveOptions jpg_Image_Save_Options = new ImageSaveOptions(SaveFormat.Jpeg);
PageRange pageRange = new PageRange(0, odt.PageCount - 1);
jpg_Image_Save_Options.PageSet = new PageSet(pageRange);

ODT_To_JPEG_Images_Converter jpg_Image_Streams_Handler = new ODT_To_JPEG_Images_Converter();
jpg_Image_Save_Options.PageSavingCallback = jpg_Image_Streams_Handler;

MemoryStream memoryStream = new MemoryStream();
odt.Save(memoryStream, jpg_Image_Save_Options);

// jpg_Image_Streams_Handler.jpeg_streams should now contain jpeg images

private class ODT_To_JPEG_Images_Converter : IPageSavingCallback
{
    public ArrayList jpeg_Streams = new ArrayList();
    public void PageSaving(PageSavingArgs args)
    {
        args.PageStream = new MemoryStream();
        args.KeepPageStreamOpen = true;
        jpeg_Streams.Add(args.PageStream);
    }
}