Error in creating Page object from a visio file

Hello,

I am using Aspose.Diagrams v6.2.0.

It gives an error when trying to create a Page Object.
Moreover, I have converted vsd to vdx and in the output document, there is only one page whereas there were 8 pages in the original document.

Following sample code is used:

Diagram diagram = new Diagram("MeetRoom.vsd");
Page srcPage = diagram.getPages().getPage("Room");
if (srcPage == null) {
throw new Exception("Exception");
}
DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VDX);
diagram.save("MyOutput.vdx", options);


When I use Page srcPage = diagram.getPages().getPage(0); it returns a page object,
but when I use Page srcPage = diagram.getPages().getPage(1); it returns null.

Can you please look into this issue.

I have attached the vsd file for your reference.

Thanks,
Neha

Hi Neha,


Thank you for contacting support. Please note that getPage method of the PageCollection class takes page ID as the parameter. In your source Visio, there is no page with ID “1”.
Neha Gautam:
but when I use Page srcPage = diagram.getPages().getPage(1); it returns null.
Please use this line of code to get the Visio page by index:
[Java]
Page srcPage = diagram.getPages().get(1);

We have converted your Visio diagram to VDX using the latest version 6.2.0 of Aspose.Diagram for Java API. It renders all the Visio pages. We have attached its resultant VDX file to this reply for your kind reference. Please let us know in case of any confusion or questions.

Hi Neha,

Neha Gautam:
there is only one page whereas there were 8 pages in the original document.

In addition to the above reply, it appears as you’re not applying a valid Aspose license. Please refer to the following help topic: Apply a License to Aspose.Diagram for Java Assembly