Created
March 1, 2024 13:55
-
-
Save farhan-raza/89cf9ed72bf7f9294bd7c1c87ff3423d to your computer and use it in GitHub Desktop.
Convert Word Document DOC DOCX to JPG PNG Image in C# .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the input Word document | |
Aspose.Words.Document doc = new Aspose.Words.Document("Words.docx"); | |
// Initialize an object of ImageSaveOptions class | |
Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg); | |
// Set the "PageSet" to "0" to convert only the first page of a document. | |
options.PageSet = new Aspose.Words.Saving.PageSet(0); | |
// Set the image's brightness and contrast. | |
options.ImageBrightness = 0.3f; | |
options.ImageContrast = 0.7f; | |
// Set the horizontal resolution. | |
options.HorizontalResolution = 72f; | |
// Save output JPG image | |
doc.Save("Word-to-JPG.jpg", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the input Word document | |
Aspose.Words.Document doc = new Aspose.Words.Document("Words.docx"); | |
// Initialize an object of ImageSaveOptions class | |
Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png); | |
// Set the horizontal resolution. | |
options.HorizontalResolution = 72f; | |
// Save output PNG image | |
doc.Save("Word-to-PNG.png", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment