Setting Page Size When Rendering Visio to PDF or PNG

I was happy to read about the support for setting pre-defined paper sizes when rendering Visio to PDF or PNG. I can’t find a sample or instructions about how to use this feature, though. Could you post a sample?

Hi Tim,

One more option for page size has been added in ImageSaveOptions as you can see in the following code.

string fileName = "TestDrawing.vsd";
Diagram diagram = new Diagram(fileName);
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
options.PageSize = new PageSize(PaperSizeFormat.A4);
diagram.Save("TestDrawing_A4.png", options);
options.PageSize.PaperSizeFormat = PaperSizeFormat.Letter;
diagram.Save("TestDrawing_Letter.png", options);
options.PageSize.PaperSizeFormat = PaperSizeFormat.B6;
diagram.Save("TestDrawing_B6.png", options);
options.PageSize.PaperSizeFormat = PaperSizeFormat.Tabloid;
diagram.Save("TestDrawing_Tabloid.png", options);
options.PageSize.PaperSizeFormat = PaperSizeFormat.Custom;
diagram.Save("TestDrawingDiagramPaperSize1.png", options);
diagram.Save("TestDrawingDiagramPaperSize2.png", SaveFileFormat.PNG);

Please feel free to contact us in case you have further comments or questions.

Best Regards,

That’s great, thanks for your help. I’ve got the PNG files working now.


Is there a sample for PDF files? PdfSaveOptions doesn’t appear to have a .PaperSizeFormat option.

Hi Tim,

This issue has been logged into our issue tracking system as DIAGRAM-33198. We will let you know as soon as this option is added to the PdfSaveOptions. Sorry for the inconvenience.

Please feel free to contact us in case you have further comments or questions.

Best Regards,

The issues you have found earlier (filed as DIAGRAM-33198) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.