Read only the first page of Visio Diagram using Java with Aspose.Diagram

My development language: Java, I have bought the license
A 20-page visio file, I only need read the first page, (3.9 MB)

Here’s my code

Diagram diagram = new Diagram(inputStream);
Page page = diagram.getPages().get(0);

This code can read the first page, But it takes too long.
This line of code is mostly a waste of time

Diagram diagram = new Diagram(inputStream);

Is there any efficient way to read the first page? thank you!


It is necessary to initialize Diagram Class with file in order to perform operations and read data from the file. However, we have noticed that API was taking 27 seconds while loading the file. For the sake of further investigation, we have logged a ticket as DIAGRAMJAVA-50681 in our issue tracking system. We will further look into details of it and keep you posted with the status of its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as DIAGRAMJAVA-50681) have been fixed in Aspose.Diagram for Java 20.1.

thank you very much

this is my code , but it doesn’t seem to work

long start = System.currentTimeMillis();
    LoadOptions loadOptions = new LoadOptions();
    ArrayList pageList = new ArrayList();

    Diagram diagram = new Diagram(inputStream, loadOptions);

    long end = System.currentTimeMillis();

What should I do?


Please try using following code snippet and let us know in case you still face any issue.

LoadOptions options = new LoadOptions(LoadFileFormat.VSDX);