Export to SVG and PNGs
Brought to you by:
andreasb123,
auroux
Hi
This is my work with xournal in implementing the ability to export the journals to PNG files and svg.
For the png's each page is printed to a single png file.
For the svg it implements tiny 1.2 draft and mantains most of the structure from xournal while also providing a valid svg file.
If you have any questions or complains please submit them.
Warning: The svg file is not usable with inkscape but renders fine in others. It does not support <page> and <pageset> tags
SVG and Png implementation for Xournal
Hi,
I was looking into doing the exact same thing :) I'm wondering why are you not using your print_to_cairo_surface on a cairo svg-surface to create the svg as well?
Mr Auroux pointed out that it would be difficult to re import back the svg generated by cairo. Also a lot of information from xournal data structure would be lost.
Another important aspect is that the cairo surface doesn't support multi pages.
Anyway if you really want the cairo svg just use the print to cairo surface. it would be a very similar function to print_to_pngs
Thanks for the explanation / clarification!
I didn't expect that its would be needed to get reimported.
Btw ruling inkscape out also killed my only usecase for svg-export, so maybe I'll implement a cairo-based exporter for my own use or keep using pdf-export for importing stuff into inkscape.
That is what i first thought as well but Mr Auroux is the project leader. Anyway i have the cairo code. There is only one problem. You want multiple svg files for each page? Just give me some directions and i shall provide the solution
Cheers
I'm not an expert on SVG at all, so I'll let you guys decide what you think is best for now. Let me just paraphrase what I wrote to the patch author over e-mail. My main input was that there are different use cases for SVG, the main ones I can think of being:
(1) using SVG as an alternative data storage format (instead of xoj) for interoperability; this requires the SVG code to be easily parseable and to contain all the information needed to reconstruct the xoj file;
(2) exporting to SVG for importing into Inkscape and others: this requires the SVG code to be easily parseable by other applications out there, Inkscape among them;
(3) since Jarnal uses zip archives of SVG files, exporting to Jarnal format should be kept in mind as a future feature that will re-use the SVG export code.
Additionally, there is a big difference between printing to SVG (which would include the page backgrounds such as PDF files) and exporting to SVG (which, presumably, would only include the annotations, or at least wouldn't convert the background PDF file to SVG code). Both will need to eventually be possible. "Printing to SVG" clearly requires cairo (only way to process the PDF background via poppler and turn it into SVG code), "Exporting to SVG" could be done with or without cairo but arguably it's a simple text transformation and should not require any complicated code such as cairo.
I was hoping that a same SVG code would be both re-importable in xournal (if it doesnt include converted PDF background into the SVG code) and in inkscape, but maybe that was naive.
Denis
The code i have written is perfectly usable within inkscape if not for the <Page><Pageset> tags. But does it really make sense to have a journal without a subdivision of pages. One quick and very dirty of assuring compatibility would be just changing the <Page><Pageset> to <g> tags with id as the page number
Please include this Patch into the main-branch :) I m currently on a Windowssystem and Xournal is exactly the tool i needed to take notes in freedom, but exporting it to SVG would give me so much more freedom, because this is an open standard. Please include this patch, pleaseeeee :)
Hi, how do I apply the cairo.patch to a (wonderfully) working xournal, i.e. adding svg/png-export capability? I'm running Linux Mint 9, i.e. Ubuntu Lucid Lynx. Do I need additional (cairo) packages?
Sorry to bother you, but I'm just switching to Linux and taking my first humble steps into that direction. Thanks.
Hi i have not been following the xournal project recently and i think the patch was against an older version than the most recent so if you have some experience you may try to adapt it manually and even update this thread. Another sugestion i give you is to try to print to a file and i think there is an option to print to an SVG file.
Any updates on this? Or otherwise, any suggestion of a well working, apt-getable solution that supports SVG, on Ubuntu?
Last edit: Samuel Lampa 2017-11-27
I'm afraid this patch hasn't been updated. Given its age it is quite
unlikely to work fully with current versions of xournal (images and some
other features wouldn't export), but the basic features probably still
work fine.
Denis
On 11/27/2017 02:07 AM, Samuel Lampa wrote:
--
Denis Auroux
UC Berkeley, Department of Mathematics
817 Evans Hall, Berkeley CA 94720-3840, USA
auroux@math.berkeley.edu
Related
Patches: #49