Convert XML to jpg

If the process was deployed to the engine, there is an image resource already present in the system. The following code will get the latest version of “lamdaProcess” and write it to a file called “processImage.png”:

ProcessDefinition process = repositoryService.createProcessDefinitionQuery().processDefinitionKey("lamdaProcess").latestVersion().singleResult();
InputStream stream = repositoryService.getResourceAsStream(process.getDeploymentId(), process.getDiagramResourceName());

File targetFile = new File("processImage.png");

try {
    java.nio.file.Files.copy(
            stream,
            targetFile.toPath(),
            StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
    e.printStackTrace();
}
1 Like