Hello !
I've made with Inkscape some layers to add information on maps. With Inkscape it's easy to show/hide these layers.
I want some people (not using Inkscape) to access these maps, keeping the ability to choice the visible layers.
I used to give them PDF version of the maps : could I generate PDF using interactive features of the format to do this ? Or should I keep it in SVG (that they would open with FireFox or any browser) using Javascript interactivity features ? But I don't know the javascript commands to activate/deactivate the layers...
Hopefully..
hide/show layers in generated PDF, or SVG in a browser
-
- Posts: 3
- Joined: Sat Aug 21, 2010 1:22 am
Re: hide/show layers in generated PDF, or SVG in a browser
Maybe Jessyink extension can help, it turns Inkscape layers into slides using javascript.
http://freshmeat.net/projects/jessyink
http://freshmeat.net/projects/jessyink
just hand over the chocolate and nobody gets hurt
Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download
Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download
Re: hide/show layers in generated PDF, or SVG in a browser
There probably is a way of doing it with pdf's, but I don't know how you would do it.
Javascript can defiantly do what you want though, although it takes a bit of effort ;-(
I have actually gone half way towards this before, but it got too messy to make it work properly, so I may try to tidy it up a bit and post it here for you to look at.
In the meen time, have a look at this threed: viewtopic.php?f=16&t=5237, and this example from it: http://test.netstreams.org/jsvg/jsvg.svg . It's not quite what you want, but the principle is the same.
Javascript can defiantly do what you want though, although it takes a bit of effort ;-(
I have actually gone half way towards this before, but it got too messy to make it work properly, so I may try to tidy it up a bit and post it here for you to look at.
In the meen time, have a look at this threed: viewtopic.php?f=16&t=5237, and this example from it: http://test.netstreams.org/jsvg/jsvg.svg . It's not quite what you want, but the principle is the same.
Re: hide/show layers in generated PDF, or SVG in a browser
Ok, look at this from within firefox: http://www.openclipart.org/people/tom/m ... test_1.svg
you should be able to copy the key layer and adapt as necessary:
1) select a show / hide button
2)right click -> Object peoperties
3) expand the 'interactivity' section
4) under 'onclick': just edit the layer1, layer2 in getElementById to match the id of the layer you want to show hide with that button.
The javascript is fairly simple, so hopefully you will be able to understand it.
you should be able to copy the key layer and adapt as necessary:
1) select a show / hide button
2)right click -> Object peoperties
3) expand the 'interactivity' section
4) under 'onclick': just edit the layer1, layer2 in getElementById to match the id of the layer you want to show hide with that button.
The javascript is fairly simple, so hopefully you will be able to understand it.
-
- Posts: 3
- Joined: Sat Aug 21, 2010 1:22 am
Re: hide/show layers in generated PDF, or SVG in a browser
Thanks a lot !
I adapted the example from OpenClipArt, changing it with a single button on/off. It works fine with (from slower to faster) FireFox, Opera, Chromium.
The problem is that I can't impose a browser at my job, and they massively use M$ IE...
IE 9 is announced to natively read SVG, but for the moment...
So I ask you again for information with PDF : layers information aren't conserved when converted. Will it be in future version ?
Thanks again.
I adapted the example from OpenClipArt, changing it with a single button on/off. It works fine with (from slower to faster) FireFox, Opera, Chromium.
The problem is that I can't impose a browser at my job, and they massively use M$ IE...

IE 9 is announced to natively read SVG, but for the moment...
So I ask you again for information with PDF : layers information aren't conserved when converted. Will it be in future version ?
Thanks again.
Re: hide/show layers in generated PDF, or SVG in a browser
try scribus for multipage .pdf, scribus imports .svg files
Re: hide/show layers in generated PDF, or SVG in a browser
OK, if you need to go down the PDF route (and you have the latest Adobe Reader) then you can use the latest Scribus to make the layers in the PDF.
From within Scribus:
1) Go, File->Import->Get Vector file... select the .svg document
2) Right click on the imported image and ungroup. Each inkscape layer will now be a separate object.
3) Go to Window -> Layers. Add enough new layers.
4) Select each object and right click and select Send to layer...
To save as a pdf:
File ->Export -> Save as PDF...
File Options:
Compatibility: PDF 1.6 (Acrobat 6)
and Include Layers.
In Adobe PDF Reader 9 the layers dialogue is the second option down the side bar.
From within Scribus:
1) Go, File->Import->Get Vector file... select the .svg document
2) Right click on the imported image and ungroup. Each inkscape layer will now be a separate object.
3) Go to Window -> Layers. Add enough new layers.
4) Select each object and right click and select Send to layer...
To save as a pdf:
File ->Export -> Save as PDF...
File Options:
Compatibility: PDF 1.6 (Acrobat 6)
and Include Layers.
In Adobe PDF Reader 9 the layers dialogue is the second option down the side bar.
-
- Posts: 3
- Joined: Sat Aug 21, 2010 1:22 am
Re: hide/show layers in generated PDF, or SVG in a browser
Thanks for all again : this solution works, apart from the fact that little things are lost converting from Inkscape to Scribus (mainly problems of text alignment, solved by converting text to path). The fact is that my Inkscape document is complex (City map with more than 600 objects including complex pathes, and 15 layers), and Scribus open it much more slowly than Inkscape...
The main difficulty is that you must re-create all layers each time your Inkscape source evoluate... Boring. But waiting for Inkscape to export layers to PDF I'll use this method. To get it easier to select groups to move in particular layers, you just have, for each layer, to put (out of the document boundaries) a text object with the layer's name : under scribus, after ungroupping, you just need to click on it as a tab to select the group you want.
The main difficulty is that you must re-create all layers each time your Inkscape source evoluate... Boring. But waiting for Inkscape to export layers to PDF I'll use this method. To get it easier to select groups to move in particular layers, you just have, for each layer, to put (out of the document boundaries) a text object with the layer's name : under scribus, after ungroupping, you just need to click on it as a tab to select the group you want.
-
- Posts: 2
- Joined: Tue Feb 02, 2010 2:29 am
Re: hide/show layers in generated PDF, or SVG in a browser
tomh wrote:OK, if you need to go down the PDF route (and you have the latest Adobe Reader) then you can use the latest Scribus to make the layers in the PDF.
From within Scribus:
1) Go, File->Import->Get Vector file... select the .svg document
2) Right click on the imported image and ungroup. Each inkscape layer will now be a separate object.
3) Go to Window -> Layers. Add enough new layers.
4) Select each object and right click and select Send to layer...
To save as a pdf:
File ->Export -> Save as PDF...
File Options:
Compatibility: PDF 1.6 (Acrobat 6)
and Include Layers.
In Adobe PDF Reader 9 the layers dialogue is the second option down the side bar.
Obviously not the direct solution from Inkscape. But for me it is the best way to export a PDF with layers.
Thank you!