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

Free Support Forum - aspose.com

Interrupt the save operations (Java)

Hi, I’d like to know when the InterruptToken will land in java world (Sorry it is already the case).
We have cases where we save a Words document as image and it take too long.
We’d rather kill the processing thread. But sadly it does not seems to work.

Another question is it possible to save only a page of a document. We’d like to provide a per page preview of the document.


I am afraid, in Aspose.Words for Java we do not have InterruptionToken class because Aspose.Words for Java relies on Java’s Thread functionality. You can use following code example to achieve your requirement. Hope this helps you.

public void testThreadInterruption() throws InterruptedException
    // run Aspose.Words long operation in a separate thread
    Thread infiniteThread = new Thread(infiniteProcessingLoop());

    // interrupt it in a while

    // wait till it dies

    // check if it is dead
    if (infiniteThread.getState() == Thread.State.RUNNABLE)
        System.out.println("Thread didn't stop properly");

private static Runnable infiniteProcessingLoop()
    return new Runnable()
        public void run()
                while (true)
                    Document doc = new Document("input.docx");
            catch (Exception ex)


Thanks for your answer