Open Source Software Forum

Issue with Docx conversion to image

Hello Team,
we recently procured Aspose.Word for Java and are facing issues with document conversion to image (png/jpeg)

We are performing the below steps to generate JPEG, however, the image produced does not render the text fetched via bookmarks, it only renders the actual content of the docx file.

public static void main(String[] args) throws Exception {

    // The path to the documents directory.
    String dataDir = Utils.getDataDir(LoadAndSaveToStream.class);
    // Open the stream. Read only access is enough for Aspose.Words to load a document.
    InputStream stream = new FileInputStream(dataDir + "Document.doc");
    // Load the entire document into memory.
    Document doc = new Document(stream);
    // You can close the stream now, it is no longer needed because the document is in memory.

    // ... do something with the document
    // Convert the document to a different format and save to stream.
    ByteArrayOutputStream dstStream = new ByteArrayOutputStream();, SaveFormat.RTF);
    FileOutputStream output = new FileOutputStream(dataDir + "Document Out.rtf");

    System.out.println("Document loaded from stream and then saved successfully.");

We are also using Aspose.Words for .Net and the docx is getting converted to image properly using memstream. However, with Java we are facing issue in conversion to image.

Would appreciate your assistance.


This topic has been moved to the related forum: