import com.aspose.words.Document; import com.aspose.words.ImageSaveOptions; import com.aspose.words.SaveFormat; public class Program { public static void main(String args[]) throws Exception { new Program().generateImages("E:\\pro2\\Document.docx"); // here i am specifying the path of the document file within code itself } public void generateImages(final String sourcePath) { try { Document doc = new Document(sourcePath); ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG); options.setJpegQuality(100); options.setResolution(100); for (int i = 0; i < doc.getPageCount(); i++) { String imageFilePath = sourcePath + "_outputimg_" + i + ".jpg"; options.setPageIndex(i); doc.save(imageFilePath, options); } } catch (Exception e) { e.printStackTrace(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)