Closed mararad closed 3 months ago
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...
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.
I would really appreciate it if this was developed, as I'm really stuck how to do this :)
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.
It would be very nice to have this feature!
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?
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.
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 as seperate layers and merging multiple PDF into one using one PDF per layer.
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.
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.
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.
i dont know what is so complicated to mark resources for pdf layers.
it is as simple as wrapping the regular output in the following:
/OC /L101 BDC q <content-stream> Q EDC
and creating a layer resource like that:
101 0 obj
/Type /OCG /Name (L101)
endobj
and adding the resource to the page "Properties" resources.
<< /Type /Page /Resources << /Properties << /L101 101 0 R>> >>
-- T
i dont know what is so complicated to mark resources for pdf layers.
Then submit a PR if it's that easy.
LOL
draw.io is also closed to contributions. We follow a development process compliant with our SOC 2 Type II process. We do not have a mechanism where we can accept contributions from non-staff members.
not allow by your own policies !
I will make an exception for this case. Please submit the PR.
@terefang Yes please. You would be my/our hero!
need to first ask my company if this is allowed by contract.
nonetheless while awaiting confirmation, i searched the codebase to to look how you generate pdf.
from the package.json files it looks like you use pdf-lib from npmjs.
i also found the PDFDocument initializer, but then i am lost.
i only found the pdfToPDF method but this is not part of the pdf-lib api.
so can you point me in the right direction (and file) where pdf-export actually starts ?
my javascript is a little bit rusty, since i wrote the last js i remember in 2010.
We convert HTML to PDF on line 714
We convert HTML to PDF on line 714
that would mean it is "technically impossible" to implement layers because you are rendering thru the browser implementation and not some interfacing pdf library.
unless you change the rendering, of course !
@terefang
that would mean it is "technically impossible" to implement layers because you are rendering thru the browser implementation and not some interfacing pdf library. unless you change the rendering, of course ! Yes, unfortunately there is no documentationat all mentioning layers in the used library:
- PDF-LIB · Create and modify PDF documents in any JavaScript environment. url:: https://Hopding.github.io/ abstract: Create and modify PDF documents in any JavaScript environment.
If you are searching for other soultions (to render), I want to mention the term Optional Content Group (OCG)used in a layer features in PDF documents to organize content.
For me it is unfortunately beyond my (current) scope to support this on the javascript side.
Thanks for picking this up.
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.