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

Free Support Forum - aspose.com

Visio page size is bigger than Diagram

When I save Aspose Diagram as Visio, page size is much bigger than actual diagram (see the screenshot of resulting Visio). Is it possible to crop it?
VISIO Page size.png (16.8 KB)


Before saving a Visio drawing, we can set AutoFitPageToDrawingContent property of the DiagramSaveOptions class to true as follows:

// save diagram
DiagramSaveOptions opts = new DiagramSaveOptions();
opts.AutoFitPageToDrawingContent = true;
opts.SaveFormat = SaveFileFormat.VSDX;
diagram.Save(MyDir + “Output.vsdx”, opts);

If this does not help, then please send all details of the scenario, including source drawing and code. We will investigate your scenario in our environment, and share our findings with you.

@imran.rafique, thanks for helping, now it looks better!

@imran.rafique, but still in some cases page is bigger then a diagram. The size of diagram is predefined in SVG and it could be also set to Visio. Can you suggest updating page size manually by Aspose.Diagram?


Please send us the problematic drawing and code. We will investigate your scenario in our environment, and share our findings with you.

@imran.rafique, here is a NetBeans project: https://drive.google.com/open?id=1yvh2B1xATF-UuSpnGIkEgYEbrZlgCCFy
To check the execution please, select Runner.java as main class and also don’t forget to attach your Aspose.Diagram.lic file to \src\main\resources\templ. Resulting drawing will be added to the project root.

As you will see in the resulting drawing ifd1.vsdx, the page size is much bigger then diagram itself.
I have used setAutoFitPageToDrawingContent(true), but it does not help always.

Please, share your findings or suggest some workarounds to change a page size using Aspose (diagram size is known value from an input SVG file)


Thank you for sharing requested data.

We were able to notice the difference with page size of Visio file. A ticket with ID DIAGRAMJAVA-50609 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is investigated and resolved.

We are sorry for the inconvenience.

Hello @Farhan.Raza,
we noticed that version 18.8 has been released, and it contained one of the bugfixes that we need in order to give some real value to our customers. Thank you. Unfortunately, the sizing problem has not been dealt with - can you share some information with us if you are still working on this issue?


Thank you for your kind feedback.

Please try using below code snippet in your environment and then share your kind feedback with us.

public Object createVisio(IFDVisioContext ctx) throws Exception {

ctx.getParentTransform().translate(0, getRectangle().getHeight());

Diagram diagram = new Diagram();
// Set CI metrics

// Load master template
Diagram masterDiagram = new Diagram(ctx.getBaseMasterDir() + MASTER_STENCIL_NAME);
// add node's master
diagram.addMaster(masterDiagram, MASTER_NODE_NAME);

// add edge's master
diagram.addMaster(masterDiagram, MASTER_EDGE_NAME);

Page page = diagram.getPages().getPage(0);
page.getPageSheet().getPageProps().getPageWidth().setValue(20); //set page's width
 page.getPageSheet().getPageProps().getPageHeight().setValue(10);//set page's height
// add diagram and legend shapes
for (IteraplanEntity<IFDVisioContext> iteraplanEntity : getIteraplanEntities()) {
  Object visioShape = iteraplanEntity.createVisio(ctx);
  page.addShape((Shape)visioShape, MASTER_NODE_NAME);
return diagram;

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Thank you for sharing, explicit setting of page size helped me, but I think as a temporary solution.
Still it would be better to do this with oneliner: DiagramSaveOptions.setAutoFitPageToDrawingContent(true), as we have multiple diagram types and scenarios.

Kind regards


Thank you for your kind feedback.

We have recorded your comments. In case you face any issue while working with the API, please feel free to contact us and we will be more than happy to assist you.