Aspose diagram: Make a visiopage resize to fit the shapes

Hello!

How do you trigger the page to be resized?

I have tested this:

    #active_page.PagePropes.getDrawingResizeType().setValue(1)
    #active_page.PageLayout.getResizePage().setValue(1)
    active_page.getPageSheet().getPageProps().getDrawingResizeType().setValue(1)
    active_page.getPageSheet().getPageLayout().getResizePage().setValue(1)
    
    layout = active_page.getPageSheet().getPageLayout()
    layout.getResizePage().setValue(1) #PageResizeDynamic

    pagesheet = active_page.getPageSheet()
    pagesheet.getPageProps().getDrawingResizeType().setValue(1) #PageAuto

But the page is still not resized. Have to do it manually inside Visio.

Any idea?

Göran

@Gope
Please try to setAutoFitPageToDrawingContent to true before saving as this sample code:

    option = DiagramSaveOptions()
    option.setAutoFitPageToDrawingContent(True)

Thanks.

Hello Philip

Thanks for the advice.

I tried without success

save_options = DiagramSaveOptions()
save_options.SaveFormat = SaveFileFormat.VSDX:
Does not work. No Saveformat or SaveFileFormat is found.

save_options.setAutoFitPageToDrawingContent(True): ok

bpmn.save(visioname +“.vsdx”,SaveFileFormat.VSDX): ok but no resize.
bpmn.save(visioname +“.vsdx”, save_options): Saves the file in a corrupted format.
bpmn.save(visioname +“.vsdx”, ), save_options): Does not work. Only 2 parameters?

So the challenge is how to set save_options with the SaveFileFormat.VSDX) value.

Göran

@Gope
Please try this sample code:

options = DiagramSaveOptions(SaveFileFormat.VSDX)

Thanks.