Insertar imagen
losPáginaobjeto representa el área de dibujo de una página de primer plano o una página de fondo. La propiedad Pages expuesta por elDiagram La clase admite una colección de objetos Aspose.Diagram.Page.
Insertar imagen en Visio
Aspose.Diagram para JAVA API permite a los desarrolladores insertar una forma de imagen en una página. El siguiente ejemplo de código muestra cómo insertar una imagen en un dibujo 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); |
Insertar imagen en 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); |
Insertar imagen en 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); |
Insertar imagen en 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); |
Insertar imagen en 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); |