You can find all the details at: Print Visio Diagram Documents VSDX, DWGX, VSTX Programmatically in C#
Last active
August 11, 2021 21:29
-
-
Save aspose-com-gists/5ae21aefe19e33728280366226573cb8 to your computer and use it in GitHub Desktop.
Print Visio Diagram Documents VSDX, DWGX, VSTX Programmatically in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load source Visio VSD or VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Call the print method to print whole Diagram using the default printer | |
diagram.Print(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Print(Diagram diagram, string printerName, string jobName, bool isWait) | |
{ | |
if (diagram == null) | |
throw new ArgumentNullException("document"); | |
// Use Aspose.Diagram to convert the document to XPS and store in a memory stream. | |
MemoryStream stream = new MemoryStream(); | |
diagram.Save(stream, SaveFileFormat.XPS); | |
stream.Position = 0; | |
// Send a Diagram document to a printer using the XpsPrint API | |
Print(stream, printerName, jobName, isWait); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Call the print method to print whole Diagram using the printer name | |
diagram.Print("LaserJet1100"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Call the print method to print whole Diagram using the printer name and set document name in the print job | |
diagram.Print("LaserJet1100", "Test Job"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment