Description:
In our application, we handle DOCX documents that contain PNG images representing BPMN diagrams. A single document can contain multiple BPMN diagrams. In our backend, we store and track each diagram as an artifact in our database.
We also have a BPMN diagram editor where we want users to be able to edit these diagrams and insert the updated version back into the document using the OnlyOffice API.
Problem:
To enable users to edit the correct diagram, we need a way to associate backend artifact data with the actual image inside the document. Our goal is to allow users to right-click on an image, select a custom context menu item (e.g., “Edit BPMN Diagram”), and then fetch the correct XML string content from the backend to open in the editor.
Questions:
- How can we reliably associate an image in the DOCX with our backend artifact data?
- Is there a recommended approach to track images inside the document and map them to our backend artifacts?
- One idea: Since images in OnlyOffice seem to have an alternative text field, we could store a unique artifact ID in this field when inserting the image. Then, if there is a way to filter or retrieve images by alternative text, we could use it to map the selected image to its corresponding backend artifact. Would this be a viable approach? If yes can you point me to the right APIs?
- Are there other OnlyOffice APIs or best practices for embedding metadata into images to maintain this association?
Thanks!