rlespinasse / drawio-export

Export Draw.io diagrams using docker
https://hub.docker.com/r/rlespinasse/drawio-export
MIT License
63 stars 11 forks source link

Blank geometric shapes included in image exports for large diagrams #118

Open dmc1899 opened 1 month ago

dmc1899 commented 1 month ago

Having been successfully using this utility for several months on our project it appears that we have encountered a strange issue pertaining to the size (and perhaps complexity) of the drawio documents we are creating and trying to export images from.

The issue we are observing is that for certain large diagrams on specific tabs, when exported, part of the diagram is simply not visible as it appears as though a "white square" or "white rectangle" shape is overlayed on top of the image, blocking the underlying content from being rendered.

Due to confidentiality, I cannot upload images to this ticket.

However, I have proven that this issue can be consistently recreated and appears to be triggered by a combination of 1) Specific diagram complexity for a specific tab 2) Overall file size of drawio file.

At present, I can reduce the size of the overall drawio file to 1,461,767 bytes and the offending diagram is exported without "white squares" or "white rectangles" being overlayed.

However, if I add in one additional tab to the document to increase the overall file size to 1,964,704 bytes, failure occurs.

Anyone come across this?

Thanks in advance.

rlespinasse commented 1 month ago

Hello,

Thanks for using drawio-export.

Do you reproduce this issue by exporting your file directly from drawio-desktop on your locale machine?

You can also try the command line of the drawio-desktop to export the file and see if the issue is reproduced.

/path/to/drawio-desktop/draw.io -x -o output.pdf -f pdf /path/to/input-file.drawio

The two previous tests are to know if it's directly linked to drawio-desktop or how this docker image works.

[!NOTE] This may linked to the default configuration of XVFB used to enable export in a docker environment. See https://github.com/rlespinasse/docker-drawio-desktop-headless?tab=readme-ov-file#configuration for configuration point

dmc1899 commented 1 month ago

Thank you kindly for responding @rlespinasse.

I have attempted (and failed) to replicate the "export all images" behaviour using the drawio binary directly on my local machine.

I'm issuing the command /Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -a arc/desc/drawio/test.drawio where I am expecting -a to honour the request to export all pages (as per the documented behaviour) however I am only ever able to get the first page within a multi-page drawio document exported.

I notice that this container wraps a neat Rust application that you also developed to in turn wrap the calls to the drawio binary. I've looked through your code and don't see what I am doing differently.

Any thoughts?

Thank you in advance.

:)

rlespinasse commented 1 month ago

-a only works for PDF export format into a single document. If you use PNG format, specify which page you want to export, using -p.

The Rust application wraps the loop to export all pages one by one. So for your tests, you can test with a PDF export format or create a loop to export all pages one by one as a PNG file.

You can also run the Rust application directly on your local machine to replicate the behavior of drawio-export without needing a headless display server.

[!WARNING] drawio-exporter, the Rust application have limited installation possibilities (aka no single binary download - for now)