drawio icon indicating copy to clipboard operation
drawio copied to clipboard

Export layers to PDF

Open mararad opened this issue 3 years ago • 8 comments

I've worked with autocad in the past and I remember exporting a drawing to PDF and still been able to enable and disable layers in it. This is very helpful to help visualize cluttered diagrams.

mararad avatar Dec 08 '20 10:12 mararad

I agree. Please also consider an option to export layers to PDF (as separate files for each layer). I've been using this feature in OmniGraffle...

Screenshot 2021-01-12 at 20 29 01

MC-24 avatar Jan 12 '21 19:01 MC-24

It is definitely an important feature to preserve layers for roundtripping workflows. On the other hand, during import of an SVG exported eg. from Adobe Illustrator Draw.io will not keep existing layers as well. This should be possible to fix. If you need example files for testing, let me know.

Update: When exporting SVG from a layered Adobe Illustrator file in CS5 without "Preserve Editing" and reimporting again in AI CS5 the Layers are represented in named groups as well. No idea which kind of application specific markup is used to preserve the layers in eg. Inkscape SVG etc. (as long as private tags / attributes are used this may work just on application level) SVG from Illustrator can currently only be placed as a whole , not imported in an editable form.

acsr avatar Apr 09 '21 19:04 acsr

I would really appreciate it if this was developed, as I'm really stuck how to do this :)

ShonaMercie avatar Nov 29 '21 14:11 ShonaMercie

See also Discussion jgraph/drawio#2458. I support this feature. A user currently would have to resort to Visio or some other software to get this feature.

JanB1 avatar May 31 '22 05:05 JanB1

It would be very nice to have this feature!

pierrebarroca avatar Jul 07 '22 11:07 pierrebarroca

It'd be really great if this feature could be implemented! Isn't there any voting functionality to show interest in feature requests raised by someone else alreay?

schorsch0206 avatar Oct 22 '22 08:10 schorsch0206

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.

stale[bot] avatar Dec 21 '23 16:12 stale[bot]

I would like to add another aspect to the PDF Layer export feature. If you take into account, that there is a native approach to export the layered PDF in one rush, by writing the necessary structures into the PDF, you can take another approach (with some drawbacks).

Scripted Export Approach

Scripted export as seperate layers and merging multiple PDF into one using one PDF per layer.

  1. Script draw.io to iterate through a list of all currently visible layers (omit invisible layers)
  2. Export every visible layer as a single PDF with a basename and an LayerOrderID and the Layername as suffix with delimiter. Save the files in the tmp location of the OS.
  3. Combine the exported PDFs into one Layered PDF using the given order by ID and the suffix als Layername using OpenSource commandline tools (my research on this has to be added later, due not reachable now from my place of writing).

The Watermark Trick

There is one trick you can use to add layers in PDF by using the watermark / background feature first. Watermarks are actually a simple layer at the top with adjustable transformation and tranparency with a special flag.

Watermarks can be transformed to a simple PDF layer by removing the flag.

  • You add layer by layer by repeating this process.
  • You can add even the invisible layers when preserving the visibility flag in a suffix and set the visibility of the layer in the combined PDF.

This approach is similar to Python Scripts often used in Inkscape etc. to add features not possible with the default functionality but not worth a plugin or changing the general functionality.

Remark on export preserving object structures in SVG and PDF

It is not helpful that the layers are not included even in the SVG at least as groups. This would offer another approach for scripted conversion not relying on Draw.io itselv.

Inkscape can still open the SVG only without any preservation of layer structures. The Draw.io layer names are not available in the SVG XML tree or even reflected as nested structure.

acsr avatar Dec 22 '23 13:12 acsr