Created
August 4, 2023 17:29
-
-
Save farhan-raza/ee558cddc3956beb70da60017606663c to your computer and use it in GitHub Desktop.
Convert Image to Visio Online | JPG PNG BMP TIFF to Visio in C# .NET or Java
This file contains hidden or 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
// Create a new diagram | |
Diagram diagram = new Diagram(); | |
// Get page object by index | |
Page page0 = diagram.Pages[0]; | |
// Set pinX, pinY, width and height | |
double pinX = 1, pinY = 1, width = 4, hieght = 5; | |
// Import Bitmap image as Visio shape | |
page0.AddShape(pinX, pinY, width, hieght, new FileStream("C:\\Files\\tower.png", FileMode.OpenOrCreate)); | |
// Save Visio diagram | |
diagram.Save("C:\\Files\\PNGtoVisio.vsdx", SaveFileFormat.Vsdx); |
This file contains hidden or 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
// Create a new diagram | |
Diagram diagram = new Diagram(); | |
// Get page object by index | |
Page page0 = diagram.getPages().get(0); | |
// Load JPG image to insert into a VSDX | |
InputStream stream = new FileInputStream("C:\\Files\\person.png"); | |
// Set pinX, pinY, width and height | |
double pinX = 2, pinY = 2, width = 4, hieght = 5; | |
// Import Bitmap image as Visio shape | |
page0.addShape(pinX, pinY, width, hieght, stream); | |
// Save Visio diagram | |
diagram.save("C:\\Files\\PNGtoVisio.vsdx", SaveFileFormat.VSDX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment