Convert Visio to PDF format
Export to PDF
Aspose.Diagram for .NET directly writes the information about the API and Version Number in output documents. For example, upon rendering a Drawing to PDF, Aspose.Diagram for .NET populates Application field with value ‘Aspose.Diagram’ and PDF Producer field with value, e.g ‘Aspose.Diagram 17.9’.
Please note that you cannot instruct Aspose.Diagram for .NET API to change or remove this information from output Documents.
This article explains how to export a Microsoft Visio diagram to PDF using Aspose.Diagram for .NET API.
Use the Diagram class constructor to read the diagram files and the Save method to export the diagram to any supported image format.
The image below shows the VSD diagram that the code snippets below export PDF. You can use other diagram formats (VSS, VSSM, VDX, VST, VSTX, VDX, VTX or VSX) as well.
The source file. |
---|
To export VSD diagram to PDF:
- Create an instance of the Diagram class.
- Call the Diagram classs Save method and set the output format to PDF.
Below is an image of the output PDF file.
The output PDF file. |
---|
Export Microsoft Visio Drawing to PDF
The code samples show how to export Microsoft Visio Drawing to PDF using C#.
Split Multiple Pages
Aspose.Diagram for .NET allows splitting multiple pages while converting the Microsoft Visio Diagram to PDF. The following code snippet shows the functionality.
Use Page Save Callback
In case you have multiple pages, Aspose.Diagram for .NET allows using page saving callback while converting the Microsoft Visio Diagram to PDF. The following code snippet shows the functionality.
TestDiagramPageSavingCallback Class
public class TestDiagramPageSavingCallback : Aspose.Diagram.Saving.IPageSavingCallback
{
public void PageStartSaving(Aspose.Diagram.Saving.PageStartSavingArgs args)
{
Console.WriteLine("Start saving diagram page {0} of pages {1}", args.PageIndex + 1, args.PageCount);
}
public void PageEndSaving(Aspose.Diagram.Saving.PageEndSavingArgs args)
{
Console.WriteLine("End saving diagram page {0} of pages {1}", args.PageIndex + 1, args.PageCount);
//don't output pages after page index 8.
if (args.PageIndex >= 8)
{
args.HasMorePages = false;
}
}
}