Insérer une image
LaPageL’objet représente la zone de dessin d’une page de premier plan ou d’une page d’arrière-plan. La propriété Pages exposée par leDiagram prend en charge une collection d’objets Aspose.Diagram.Page.
Insérer une image dans Visio
Aspose.Diagram pour JAVA API permet aux développeurs d’insérer une forme d’image dans une page. L’exemple de code ci-dessous montre comment insérer une image dans un dessin Visio.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(AddImageToPage.class) + "Pages/"; | |
// load an existing Visio | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a particular page | |
Page page = diagram.getPages().getPage("Page-1"); | |
double pinX = 3, pinY = 3, width = 4, hieght = 4; | |
File file = new File("image.png"); | |
FileInputStream fis = new FileInputStream(file); | |
page.addShape(pinX, pinY, width, hieght, fis); | |
// Save the Visio diagram | |
diagram.save(dataDir + "AddImageToPage_Out.vsdx", SaveFileFormat.VSDX); |
Insérer une image dans SVG
Aspose.Diagram for JAVA API allows developers to insert a image shape in a page. The code example below shows how to insert a image in a Visio drawing and save as SVG format.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(AddImageToPage.class) + "Pages/"; | |
// load an existing Visio | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a particular page | |
Page page = diagram.getPages().getPage("Page-1"); | |
double pinX = 3, pinY = 3, width = 4, hieght = 4; | |
File file = new File("image.png"); | |
FileInputStream fis = new FileInputStream(file); | |
page.addShape(pinX, pinY, width, hieght, fis); | |
// Save the Visio diagram | |
diagram.save(dataDir + "AddImageToPage_Out.svg", SaveFileFormat.SVG); |
Insérer une image dans PNG
Aspose.Diagram for JAVA API allows developers to insert a image shape in a page. The code example below shows how to insert a image in a Visio drawing and save as PNG format.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(AddImageToPage.class) + "Pages/"; | |
// load an existing Visio | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a particular page | |
Page page = diagram.getPages().getPage("Page-1"); | |
double pinX = 3, pinY = 3, width = 4, hieght = 4; | |
File file = new File("image.png"); | |
FileInputStream fis = new FileInputStream(file); | |
page.addShape(pinX, pinY, width, hieght, fis); | |
// Save the Visio diagram | |
diagram.save(dataDir + "AddImageToPage_Out.png", SaveFileFormat.PNG); |
Insérer une image dans PDF
Aspose.Diagram for JAVA API allows developers to insert a image shape in a page. The code example below shows how to insert a image in a Visio drawing and save as PDF format.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(AddImageToPage.class) + "Pages/"; | |
// load an existing Visio | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a particular page | |
Page page = diagram.getPages().getPage("Page-1"); | |
double pinX = 3, pinY = 3, width = 4, hieght = 4; | |
File file = new File("image.png"); | |
FileInputStream fis = new FileInputStream(file); | |
page.addShape(pinX, pinY, width, hieght, fis); | |
// Save the Visio diagram | |
diagram.save(dataDir + "AddImageToPage_Out.pdf", SaveFileFormat.PDF); |
Insérer une image dans HTML
Aspose.Diagram for JAVA API allows developers to insert a image shape in a page. The code example below shows how to insert a image in a Visio drawing and save as HTML format.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(AddImageToPage.class) + "Pages/"; | |
// load an existing Visio | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a particular page | |
Page page = diagram.getPages().getPage("Page-1"); | |
double pinX = 3, pinY = 3, width = 4, hieght = 4; | |
File file = new File("image.png"); | |
FileInputStream fis = new FileInputStream(file); | |
page.addShape(pinX, pinY, width, hieght, fis); | |
// initialize PDF save options | |
HTMLSaveOptions options = new HTMLSaveOptions(); | |
// Save the Visio diagram | |
diagram.save(dataDir + "ExportOfHiddenVisioPagesToHTML_Out.html", options); |