Hi all,
I’m trying to create and export processes.
I’m using the API to fully create, and then export diagrams to BPMN (xml) or PNG format.
I have the SAME ModelInstance to :
But the results are very different !
The autolayout is done when the modelInstance is created.
The BPMN file :
Execute additional certification tests on Customer track.xml (10.4 KB)
The PNG file :
Here the BPMN file imported and exported from
http://demo.bpmn.io/
Execute additional certification tests on Customer track.bpmn (10.6 KB)
The PNG is very poor … Missing some objects.
The java code is :
BpmnModelInstance model = getModelInstance(discriminator, entityId, entityId, dataProvider);
String xml = Bpmn.convertToString(modelInstance);
FileUtils.writeStringToFile(new File("myActivity.xml"), xml,Charset.defaultCharset());
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
deploymentBuilder.addModelInstance("myActivity.bpmn", model).name("myActivity");
Deployment deployment = deploymentBuilder.deploy();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getDeployedProcessDefinition(def.getId());
InputStream isPng = ProcessDiagramGenerator.generatePngDiagram(processDefinition);
FileUtils.copyInputStreamToFile(isPng, new File("myActivity.png"));
Can you help me please ?
Hi @Contact-IT ,
I am afraid this is simply broken. In fact, we removed PorcessDiagramGenerator
and related code with 7.6.0, see https://app.camunda.com/jira/browse/CAM-4948 . There is no replacement for this functionality and I can’t think of a simple Java-based workaround.
Cheers,
Thorben
Oh damn, i’ll need to find another way to do that so …
Any idea please ?
I need to generate a Word document with picture of BPMN diagrams … Using the Java API …
Maybe anyone knows howto ?
EDIT : And what about the “Fluent BPMN builder API now generates BPMN diagram elements” planned for 7.7.0 ?
Sorry, haven’t got a good idea. You would need Java code that interprets the BPMN XML and builds an image out of that. I am not aware of a solution to that problem. If Javascript is an option, then you could use bpmn.io to create an SVG and/or PNG.
This feature is not about image rendering, but about generating diagram interchange elements in the BPMN XML. This is useful when you have modeling tool like Camunda Modeler that understands BPMN XML to make it render the process.
Ok, thanks for the informations …
I’ll try to get another solution right now …
Strange that no one wanna export BPMN processes directly to picture without graphical UI …
I’m back for solutions ^^
I success to run headless javascript into my JAVA application …
So, how can i do the job in full javascript with bpmn.io ?
I haven’t nodeJS support, so i need simple javascript … Is it possible ?
Using remote server with REST api is an option and provided by Camunda / BPMN.IO ?
hyj
July 20, 2018, 6:56am
7
Contact-IT:
javascript
How do you solve it, please?