Adalennis opened a new issue, #9444: URL: https://github.com/apache/hop/issues/9444
### Apache Hop version? 2.20.0 ### Java version? Java 21 ### Operating system macOS ### What happened? Reproduced on 2.20.0; the code involved is unchanged on main. The size of an exported SVG is computed from the positions and sizes stored in the file, not from what is drawn. Pipelines get large empty grey borders, and on workflows a note can be cut off. Measured with `hop export -s <folder> -t <folder>` on six samples, comparing the SVG size with the bounds of what is drawn: | File | Kind | SVG size | Drawing (x, y) | Empty left / top | Empty right / bottom | |---|---|---|---|---|---| | `mask-fields-sequence.hpl` | small pipeline near the origin | 752 x 360 | 32–552, 16–212 | 32 / 16 | 200 / 148 | | `detectlanguage.hpl` | pipeline placed far from the origin | 1557 x 824 | 623–1391, 160–676 | 623 / 160 | 166 / 148 | | `beers-wikipedia-scrub.hpl` (neo4j) | large pipeline, 22 transforms | 824 x 712 | 50–705, 32–564 | 50 / 32 | 119 / 148 | | `bespoke-minicheck.hpl` (languagemodelchat) | pipeline with 3 notes | 2279 x 1224 | 80–2079, 96–1076 | 80 / 96 | 200 / 148 | | `columns-exist-in-a-table.hwf` | workflow | 835 x 292 | 5–746, 5–242 | 5 / 5 | 89 / 50 | | `abort.hwf` | workflow with a note | 820 x 500 | 79–894, 32–450 | 79 / 32 | cut off by 74 px / 50 | The whole canvas is filled with `rgb(235,235,235)`, so all empty space shows as a grey border. Pipelines: - `PipelineMeta.getMaximum()` returns the largest transform position, or note position plus stored width and height, plus 100. - `PipelineSvgPainter.generatePipelineSvg` adds `extraSize` (100) to that. The result is always about 148 px of grey below the last transform label and 120–200 px to the right. - The canvas always starts at (0,0), and the smallest position is never subtracted. `detectlanguage.hpl` starts at x 623, so about 40% of the image is an empty grey band on the left. Workflows: - `WorkflowSvgPainter` uses `WorkflowMeta.getMaximum()` (+100) without an extra size. The borders are smaller, but the drawing can be larger than the canvas. - `BasePainter` draws a note with the larger of its stored width and the width its text needs (`calculateMinimumSize`). - `getMaximum()` only uses the stored width. In `abort.hwf` the note is at x 80 with a stored width of 640, so the canvas ends at 820. The note is drawn 814 px wide, up to x 894, and its first line is cut off at "…the hop-run command see the workf". - Pipelines have the same mismatch. Their extra 100 px hides it in these samples. Both `hop export` and Export to SVG in Hop GUI use these painters, through `PipelineSvgDiagramExporter` and `WorkflowSvgDiagramExporter`. The image on the Surefire report output page shows the grey border too: docs/hop-user-manual/modules/ROOT/assets/images/transforms/surefirereport/run-project-tests.svg (744 x 280 for a drawing about 50 px high). How to reproduce: 1. Copy `plugins/transforms/detectlanguage/src/main/samples/transforms/detectlanguage.hpl` and `plugins/actions/abort/src/main/samples/actions/abort.hwf` into an empty folder. 2. Run `hop export -s <folder> -t <output folder>`. 3. Open the two SVG files in a browser. `detectlanguage.svg` has a wide grey band on the left and below the drawing. In `abort.svg` the note is cut off on the right. Expected: the canvas fits what is drawn, from the smallest to the largest drawn coordinate, including the real note sizes and transform labels, with a small even margin on every side. <img width="776" height="388" alt="mask-fields-sequence" src="https://github.com/user-attachments/assets/c9ad8960-7084-4456-be6f-c5577f4582b3" /> <img width="844" height="528" alt="abort" src="https://github.com/user-attachments/assets/7090d21c-2656-44f2-872d-a601dd59cdf0" /> <img width="1581" height="852" alt="detectlanguage" src="https://github.com/user-attachments/assets/03c8b42c-a5f5-4b3d-b66e-057b5f643ae4" /> ### Issue Priority Priority: 3 ### Issue Component Component: Other -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
