Allow to specify `size` in the `action:export`
- [x] I agree to follow the Code of Conduct that this project adheres to.
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Is your feature request related to a problem? Please describe.
Yes. I am using the IFRAME embedding. In order to create a PNG file and store it on a remote location afterwards, I send a message like this via postMessage:
{
'action': 'export',
'embedImages': true,
'format': 'xmlpng'
}
By this I can get a nice PNG file. Unfortunately the file is cropped in a way that only the diagram is part of it. Any whitspace around the diagram, which is part of the "page" the diagram is located on gets lost.
This is the same behavior, as if one selects "size" of "diagram" in the "Export" dialog.
Describe the solution you'd like
I'd like to to be able to provide "size": "page" in the message to the "export"-API, to have the same behaviour as if once chooses "page" in the "size" field of the "Export" dialog (see screenshot below).
Describe alternatives you've considered I have checked the source code and only found this:
https://github.com/jgraph/drawio/blob/v24.6.4/src/main/webapp/js/diagramly/EditorUi.js#L16712-L16733
It looks like the message data only allows the following parameters:
-
format -
spin -
spinKey -
xml -
withSvg -
embedImages -
scale(looked promising, but apparently not the thing I need) -
border -
shadow
Additional context
I have traced down the corresponding value from the "Export" dialog to https://github.com/jgraph/drawio/blob/v24.6.4/src/main/webapp/js/grapheditor/Graph.js#L11854-L11869
The variable used throughout the codebase is exportType.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.