cancel
Showing results for 
Search instead for 
Did you mean: 

image export of running diagram

ajeje93
Confirmed Champ
Confirmed Champ

I would like to export the image of a BPMN diagram, getting the process definition from the process instance. I know that is possible to to the export of the XML in this way and using the repository service and I am wondering if it is also possible to export an image (png, jpg,...).

Thank in advance.

1 ACCEPTED ANSWER

daisuke-yoshimo
Star Collaborator
Star Collaborator

Thank you for your reply and your test code.
I see that you want to create a dynamic process and generate it's diagram image.

But, it is difficult to generate dynamic process's diagram because it have no graphic information like the following.
You should make the graphic information of dynamic process.

<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="70.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="task1" id="BPMNShape_task1">
<omgdc:Bounds height="55.0" width="105.0" x="180.0" y="160.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="35.0" width="35.0" x="370.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="105.0" y="187.0"></omgdi:waypoint>
<omgdi:waypoint x="180.0" y="187.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="285.0" y="187.0"></omgdi:waypoint>
<omgdi:waypoint x="370.0" y="187.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

I have no idea to make the properly placed process diagram.
I maked the sample code that generate a process diagram aligned in line and made pull request to your repo.
https://github.com/ajeje93/activiti-processdiagramgenerator-test/pull/1
https://github.com/daisuke-yoshimoto/activiti-processdiagramgenerator-test/blob/master/ProcessDiagra...

View answer in original post

15 REPLIES 15

daisuke-yoshimo
Star Collaborator
Star Collaborator

I'm sorry that I could not understand your intention.

Please provide the code that you tried and got error.

Sorry if I did not provide code sooner:

https://github.com/ajeje93/activiti-processdiagramgenerator-test/blob/master/ProcessDiagramGenerator...

This is my example, suppose that in the original code I retrieved the BpmnModel variable from a process instance. However, the error is the same as in my case.

daisuke-yoshimo
Star Collaborator
Star Collaborator

Thank you for your reply and your test code.
I see that you want to create a dynamic process and generate it's diagram image.

But, it is difficult to generate dynamic process's diagram because it have no graphic information like the following.
You should make the graphic information of dynamic process.

<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="70.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="task1" id="BPMNShape_task1">
<omgdc:Bounds height="55.0" width="105.0" x="180.0" y="160.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="35.0" width="35.0" x="370.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="105.0" y="187.0"></omgdi:waypoint>
<omgdi:waypoint x="180.0" y="187.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="285.0" y="187.0"></omgdi:waypoint>
<omgdi:waypoint x="370.0" y="187.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

I have no idea to make the properly placed process diagram.
I maked the sample code that generate a process diagram aligned in line and made pull request to your repo.
https://github.com/ajeje93/activiti-processdiagramgenerator-test/pull/1
https://github.com/daisuke-yoshimoto/activiti-processdiagramgenerator-test/blob/master/ProcessDiagra...

Thank you very much!

daisuke-yoshimo
Star Collaborator
Star Collaborator

> I have no idea to make the properly placed process diagram.

I'm sorry that I did not know that there was a standard solution to decide the layout arbitrarily.

You can use org.activiti.bpmn.BpmnAutoLayout.class and you do not need to forcibly create the graphic information.

new BpmnAutoLayout(model).execute();

I made new pull request to add auto layout.

Add auto layout. by daisuke-yoshimoto · Pull Request #2 · ajeje93/activiti-processdiagramgenerator-t... 

You have been of great help. Thank you again!