drawio-desktop icon indicating copy to clipboard operation
drawio-desktop copied to clipboard

The `--border` option is ignored when exporting jpg file via the command line

Open hangxingliu opened this issue 1 year ago • 0 comments

Preflight Checklist

  • [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.

You must agree to search and the code of conduct. You must fill in this entire template. If you delete part/all or miss parts out your issue will be closed.

Describe the bug

The --border option is ignored when exporting jpg file via the command line. But exporting via GUI doesn't have this issue.

To Reproduce Steps to reproduce the behavior:

/Applications/draw.io.app/Contents/MacOS/draw.io --export --format jpg --border 10 --quality 90 --output sample.jpg sample.drawio

# you can re-produce this issue in the main branch of this repo:
yarn start --export --format jpg --border 10 --quality 90 --output sample.jpg sample.drawio

Expected behavior

A padding should be added into the exported jpg file with the same size as specified in the command line option.

draw.io version (In the Help->About menu of the draw.io editor):

  • draw.io version 24.7.5
  • OS: MacOS

Additional context

This issue is came from this commit: 5cfc53f69cb6877b1fec1cada1a067af7eda7e57

The border option came from command line option is not passed to the renderPage function correctly. Although this commit can fix the crop option with border option for exported pdf, it break the border option for exported image files.

Because i see that this repo is not open for PR now, I open this issue rather than a PR. Here is my local patch for this issue. I tested it for exporting pdf and other image formats with different options

Screenshot 2024-08-15 at 06 09 19

hangxingliu avatar Aug 14 '24 22:08 hangxingliu