Any headless browser will do.
I’m still not sure what exactly you want to do. If you only want to read information from the BPMN file you don’t need bpmn-js at all. You can use bpmn-moddle which bpmn-js uses internally. bpmn-moddle can be executed in Node.js.
In regards to examples I already posted a simple example of accessing elements and their properties.
I’m already using BPMN-Moddle and getting the Element names.
I want to read the BPMN file and using the Moddle definitions get a single element back, let’s say type: bpmn:serviceTask, ID: Task_1b3yiqx
Here is that element in the definitions block
{
"$type": "bpmn:ServiceTask",
"id": "Task_1b3yiqx",
"name": "Verifies \nCC360 to MPI-API route",
"documentation": [
{
"$type": "bpmn:Documentation",
"text": "The API gateway verified that CC360 and MPI are allowed to communicate and how to route the request."
}
],
"extensionElements": {
"$type": "bpmn:ExtensionElements",
"values": [
{
"$type": "camunda:Properties",
"values": [
{
"$type": "camunda:Property",
"name": "order",
"value": "50"
},
{
"$type": "camunda:Property",
"name": "title",
"value": "Gateway routes request to MPI Server"
},
{
"$type": "camunda:Property",
"name": "failure",
"value": "Unable to complete onboarding"
},
{
"$type": "camunda:Property",
"name": "remedy",
"value": "Call HS-ESB support desk"
}
]
}
]
}
},
Then I want to create an SVG for one element, then save the SVG file. which looks like
I used your example code and got stuck at element not found error.
I know there is more framework code around your example but I don’t know where to look.
If you want to get the SVG of an element there is no way around using bpmn-js. Otherwise you’d have to implement your own functionality that creates the SVG from an element without depending on a browser.
The example I posted only works in an actual browser. You can use this example as a starting point and add those few lines.
Thank you. I knida expected that bpmn-js was going to be required.
I don’t mind using a browser to get these small SVGs generated.
The "implement my own functionality for creating SVG " sounds outside of my JS skill level right now.