SVG Import/Support, PDF Export, Inkscape Compatibility

Request For Enhancement, User feedback candidates for wiki
Post Reply
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

One of the most desired uses for OO for me is to import SVG Vector graphics and export them (together with text etc.) to PDF (for distribution and print).
The biggest step to this (after many years of no progress) seems done:
Dec. 2011: In progress : native support of the SVG graphic format in Apache OpenOffice.org - Jan. 2012: Native SVG support for Apache OpenOffice 3.4 (Incubating)
I'm very happy about it!

I use mainly Inkscape to edit (various software exports) and to create SVG files and think it is the "state of the art" SVG software and available on all platforms under GPL. By this I strongly wish and support Inkscape SVG file support from AOO. To help in the analysis of the current status I have created a test file (SVG-Test-File-2013a-Inkscape.svg) and done some tests with current software versions. Here the screenshots of the test file from the software (all in Win7x32):

Inkscape 0.48.4 r9939 & PDF export (PNG export PDF-XChange Viewer 2.5.207)
Image Image
AOO 3.4.1 & PDF export (PNG export PDF-XChange Viewer 2.5.207)
Image Image
Firefox 18.0, Chrome 24.0.1350, IE 9.0.8112
Image Image Image

Some issues in the AOO SVG handling. I would like to open a bug report if I feel comfortable in understanding the problem and AOO seems involved (I'm not a programmer or SVG code expert):
  • Line thickness (in Inkscape Stroke Style Width) is not exported correctly to PDF: only a “hairline”, except some maybe correct case. Reproducible by using an older test file (2012). Major showstopper for PDF-Export.
  • gradients differ from all other renderer interpretations: new file shows different linear gradient, in old 2012b file obvious radial gradient difference and also for linear gradient.
  • Cloned Tiles (masked) seem to be rasterized by PDF exporter maybe depending from resolution.
  • some text/links seem to be showed not on the correct place and/or comments show up?
  • blur filter is not supported (as announced). This filter maybe should be supported as first both by renderer/exporter (rasterized in PDF by export setting like in Inkscape/cairo).
  • “Hidden” objects in SVG seem to be showed by the renderer/exporter (see 2012b file, blue lines). This could maybe also a problem of Inkscape saving ("display none"?) in the test file or settings?
All Files (2 SVG, 1 ODG, 2 PDF, 7 PNG) in one ZIP file.
Attachments
SVG-Test-File-2012b-inkscape.zip
(20.7 KiB) Downloaded 496 times
SVG-Test-File-2013a-Inkscape.zip
(20.86 KiB) Downloaded 496 times
Last edited by ChrisTi on Mon Feb 04, 2013 3:31 am, edited 1 time in total.
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by acknak »

You may get some response here, but the best place for communicating with developers is on the Apache/OOo mailing list(s).

http://openoffice.apache.org/mailing-lists.html
AOO4/LO5 • Linux • Fedora 23
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

Thanks. I had contact with Armin L.G. before and he suggested to enter my wishes and bugreports to AOO in Forum/Bugzilla and maybe on the Dev-List of AOO. I prefer to start here and break down to single problems in bug reports maybe linking to this thread for more general SVG support discussions.
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by acknak »

Yes, we see alg and regina posting here occasionally, but those are the only two I've noticed. I would love to see the forums used more for development discussions, but it seems that many programmers are allergic to forums.
AOO4/LO5 • Linux • Fedora 23
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by RGB »

I tried your sample SVGs on a recent development build and obtained the same results. It is quite surprising that even inkscape do not provide a 100% fidelity on pdf export for its own file.

Other software I have on my system that can handle SVG have their own share of problems, with webkit based browsers providing the best (but not perfect) rendering output. For example, karbon14 2.5.4 fails on gradients and arrows and several objects are misplaced.
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by acknak »

As I understand it, the new SVG support is provided by an external library (I don't remember which one--rsvg maybe?) that OOo calls to render the SVG markup. This is similar to displaying an image: OO doesn't manipulate the image structure, it just calls some library to paint pixels on some part of the screen.
AOO4/LO5 • Linux • Fedora 23
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

I like forums and try to look and help there when possible. Of course, the main information flow for developers is on the mailing list, but helping users directly is also needed from my POV, be it alone to not loose 'ground contact' with user problems. But...time is limited somehow ;-)

SVG is an 'external' library in the sense that it gets loaded at runtime, but completely developed and built by AOO (and written/maintained by me). I am always happy when someone shows up errors, in which form ever :-)

Thus, let's look at the examples (thanks for them!)

(1) Line thickness: Fixed in my developer version. I can remember to have fixed it some time ago, but do not have the task number on hand
(2) Gradients: I was very careful together with Regina and I fixed some gradient stuff, mainly with the gradient's global aspect (world coordinate or object coordinate). Here I would need a concrete, simple example. For reference, I also mainly used Firwefox and Chrome, btw...
(3) Cloned Tiles:
(4) Text/Links
(5) Filters: Yes, not yet supported
(6) Hidden objects: FGixed recently when adding many SVGs to the new gallery themes, I stumbled upon this myself.

Thus, 2 to 5 need a closer look, 1 and 6 are fixed.
OpenOffice 3.3/3.4 on various systems
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Thus, for 2 to 5 we will need more details:
- Is it correct in the edit view?
- Is it correct in PDF export?
- Single small examples (so that there is not too much SVG content, I will have to look at the SVG code directly)

Thanks in advance!
OpenOffice 3.3/3.4 on various systems
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

...and - of course - this should be done with the current trunk versions. These get built from the build bots regularly, see

http://ci.apache.org/projects/openoffice/

where the latest build will reside. If possible, please ry to install these for testing. Or even better: build a version yourself (not easy for non-developers, but I know some who managed to do that already).
OpenOffice 3.3/3.4 on various systems
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

Thanks alg! It is very seldom that devs are active in Forum. I like the possibility to embed rich info (links, images, etc.).

I have now installed AOO350m1 (Build:9611) Rev. 1442201 Rev.1441718 on Win7x32
I can confirm (1) Line thickness is included in PDF exports. Thanks! This is very good and hopefully available in the next stable release.
I can not confirm (6) Hidden objects resolved for SVG-Test-File-2012b-inkscape.svg, but maybe the SVG-code is not ok and it is a minor annoyance.

There seems to be differences between the AOO versions (dev above and 3.4.1) in the following items:
(2) Gradients: radial and linear gradiants behave differently, PDF export shows signs of rasterization + white "hole" lines. It is difficult to understand what has changed in the code. A comparison with the very good/stable/small-sized Inkscape/cairo PDF export would be interesting for end users - I don't know how possible this is by codebase.
(3) Cloned Tiles: while showed/exported in 3.4.1, this seems not anymore the case in the dev

I will do single analysis of 2 to 5 (edit view, PDF export, small SVG examples) later.

AOO350m1 (Build:9611) Rev. 1442201 Rev.1441718 on Win7x32 & PDF export (PNG export PDF-XChange Viewer 2.5.207)
Image Image
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi Chris,

Thanks for taking a look. (6) is pretty new, not sure in which version it went. Unfortunately I got a bad cold and I'm down probably this week...
Single analysis of (2)..(5) would be very appreciated, thanks in advance. I'm of course interested to make it even better...
Just one caveat which exists currently: The double precision vector data from the internal primitives (@acknack: no external renderer; we are rendering ourselves based on the graphics primitives I had added some years ago) goes to rhe pretty old and limited Metafile format (see gdimtf.hxx in vcl module) . Thats because when the PDF export was written the primitives were not yet available. To get the full quality, the PDF export would have to be adapted to directly use the full information from the primitives.
POC is the state of SVG rendering in the edit views, so the potential is there after import as primitives...
BTW: working on improving render speed currently, but there is other stuff for the 4.0, too, so not sure how far this will proceed.
Any help in both issues more than welcome...

Gruesse:-)
Last edited by RoryOF on Mon Feb 11, 2013 8:15 pm, edited 1 time in total.
Reason: Corrected typos to improve clarity. [RoryOF, Moderator]
OpenOffice 3.3/3.4 on various systems
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

Hope you get well alg.
Like RGB said, there is a surprising variety of rendering and PDF printing of SVG code.
I'm currently not able to say which one interpretation is correct, but I will first focus on gradients, as I think they are the most important feature in the "unfixed" items in the list. I have created a new gradient sample SVG file using always a gradient with 3 colors: yellow, magenta (on 50%) and cyan on different shapes:
  • Square with diagonal linear gradient
  • Circle with radial gradient
  • Rectangle with diagonal linear gradient
  • Ellipse with radial gradient
  • Equilateral Triangle with linear gradient perpendicular to a side
The only exact interpretation seems to me the PDF output of Inkscape 0.48.4 r9939 (PNG export PDF-XChange Viewer 2.5.207): linear gradient perpendicular to the diagonal "definiton line" and radial gradient with the same shape (circle or ellipse).
Image

Inkscape 0.48.4 r9939: while radial gradient seems ok, the linear gradient seem "non perpendicular" to "definiton line":
Image

AOO350m1 (Build:9611) Rev. 1442201 Rev.1441718 on Win7x32
Renderer: While linear gradient seems ok, radial gradient seems to be a "vertical ellipse"
Image

AOO350m1 PDF output: "geometric definitions" like renderer (uncorrect radial gradient), but filling seems "flat" and "line filled" with "white spaces".
Image

Chrome 24: like Inkscape radial gradient seems ok, the linear gradient seem "non perpendicular" to "definiton line":
Image

Firefox 18: like Inkscape radial gradient seems ok, the linear gradient seem "non perpendicular" to "definiton line":
Image

This W3 SVG 1.1 page may describes the exact definition (not sure about that).
Please report here what you think (or sources show) should be the correct interpretation of the SVG gradient code.


All 10 files for download (SVG, PDF, PNG) (only SVG see attachment).
Attachments
SVG-Test-File-2013a-Inkscape_Gradients_opt-plain.zip
(1.09 KiB) Downloaded 440 times
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
regina
Posts: 67
Joined: Sat Apr 05, 2008 4:55 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by regina »

I think, that the radial gradient has an error in AOO and have written https://issues.apache.org/ooo/show_bug.cgi?id=121801. To me it seems, that when applying the gradientTransform-matrix, the scaling is wrongly applied to the radii.
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi Regina,
thanks for the task, I thinkk something similar. Somehow the transformation at the gradient itself seems to be lost in this scenario. Not sure when I will have time for a look, currently busy with other stuff. But the task will help keeping track.
OpenOffice 3.3/3.4 on various systems
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

ALG: I found (took) now the time to look into this and fixed it (see https://issues.apache.org/ooo/show_bug.cgi?id=121801 for more info). Checked with the example files provided by ChrisTi (thanks for these!) and looks good. Thus, the gradient issue is fixed. To be sure I also checked with various SVGs I have collected over time (from bug reports and other stuff) which usually show errors early. Checke din as r1482726. Please - as soon as developer builds are available - have a look at it and check it out.

So we have open:

(4) Text/Links
(5) Filters: Yes, not yet supported

Where (5) is currently simply not supported (would be a lot of work).
Are there more details for (4)? Are there errors with Text import at all or only concerning links?

HTH! Sincerely Armin
OpenOffice 3.3/3.4 on various systems
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

Thanks ALG! Have used Apache_OpenOffice_4.0.0_Win_x86_install_en-US.exe_1484333.exe - Windows Nightly (aoo-win7) May 20 04:30 #622
See comparison of new AOO vs. old screenshots:

Inkscape 0.48.4 r9939 & PDF export (PNG export PDF-XChange Viewer 2.5.207)
Image Image
AOO 4.0.0 nightly 1484333 & PDF export (PNG export PDF-XChange Viewer 2.5.210)
Image Image
Firefox 18.0, Chrome 24.0.1350, IE 9.0.8112
Image Image Image

  • (1) Line thickness: exported correctly to PDF. OK.
  • (2) gradients radial and linear: seem OK. Will try to check better.
  • (3) Cloned Tiles (masked) seem to be rasterized by PDF exporter maybe depending from resolution: not showed - OPEN: do not show up. I will try to check
  • (4) some text/links seem to be showed not on the correct place and/or comments show up? OPEN. I will try to check
  • (5) blur filter is not supported (as announced). UNSUPPORTED - For AOO 4 there should be a notice that SVG files using this feature/s should not be printed to PDF from AOO. For the future looking at Inkscape/cairo sourcecode could be maybe interesting.
  • (6) “Hidden” objects in SVG seem to be showed by the renderer/exporter (see 2012b file, blue lines). UNCLEAR? Have note checked again. Issue with minor priority.
  • (7)Path stroke style (new): there seems to be a difference in the "edge join" rendering - while other renderers do not show a line edge under the Mid Marker Dot, AOO renderer/exporter does so.
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi ChrisTi,

Thanks for checking this. Please, do the comparisons based on the edit view visualization of AOO, not on the PDF export. I know that this is what counts for the user, but for me as developer it is necessary to separate where the problem comes from. The SVG import itself is best checked with the edit view visualization where primitives are used and the full spectrum of imports is shown. For PDF export or printing in-between steps in AOO (older parts) unfortunately play a role which convert the stuff to metafiles on that way. That conversion looses data/information and needs to be enhanced to use primitives in the future.

Thus, to detect errors in the importer, could you have another look just based on the edit view visualization, please?
Thanks in advance,

ALG
OpenOffice 3.3/3.4 on various systems
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi ChrisTi,

Case (6): I did not find anything 'hidden' in 2012b test files, could you provide a (probably reduced) example, please?

Sincerely Armin
OpenOffice 3.3/3.4 on various systems
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

Sorry for the delay ALG. I have now installed Apache_OpenOffice_4.0.0_Win_x86_install_de.exe_1499006.exe Windows Nightly (aoo-win7) Jul 03 04:30 #676

I have checked gradients: I can confirm the radial gradient issue is not anymore present. I noticed the included AOO PNG export did shrink the image horizontally. So I have done a simple screenshot. Not all lines/elements (visible in Inkscape) are rendered in AOO:
Image Inkscape
Image AOO4

I have attached the used SVG file. I noticed that rendering behaviour in Inkscape (difference between constructing linear gradients and transforming), PDF export and PDF viewing still shows a widespread type of differences and I'm not able to tell what is correct and what is wrong. I hope eventually all software will interpret SVG code the same way and also in PDF the renderers will be more similar.

I hope later I can have a look at the other cases.
Attachments
SVG-Test-File-2013b-Inkscape_Gradients.svg.zip
(8.26 KiB) Downloaded 385 times
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi ChrisTi, no worries with the delay, I'm pretty busy currently, too.
Thanks for checking; I used your testfile and it's unbelievalble how much useless info is in the SVG XML file itself saved from inkscape, sigh.
Stripped it to something simple, did a small fix in AOO4.0 trunk, looks good.
For the missing geometry I'll write another bug.

"I hope eventually all software will interpret SVG code the same way and also in PDF the renderers will be more similar."

Yes, that's why it's so good and valuable that you check this and continue to show SVGs which are shown differently. Step by step we will get closer!

I see your need for PDF export, but once again, it's two steps:
(1) The import has to be 100%, this can be checked by comparing the visualization in the edit view
(2) The exports (including PDF) need to be converted to make use of the enriched graphic information from primitives

Step (2) is needed, but 2nd one. Let's concentrate on step (1) which is a prerequisite to (2) being as perfect as possible!

Sincerely,
Armin
OpenOffice 3.3/3.4 on various systems
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi ChrisTi,

I wrote https://issues.apache.org/ooo/show_bug.cgi?id=122724 for the missing lines; I already have an idea what may be happening ;-)
OpenOffice 3.3/3.4 on various systems
alg
Posts: 53
Joined: Tue Apr 03, 2012 5:02 pm

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by alg »

Hi ChrisTi,

task https://issues.apache.org/ooo/show_bug.cgi?id=122724 is fixed, all control paths are imported now correctly. The criteria for line-only was too tight (no width 'or' no height instead of 'and' no height). It worked for two-point lines, though. In your test file, straight lines with more than two points are used (due to the marker layout probably). Good catch! Unfortunately too late for AOO4.0, but will be in AOO4.1 ;-)

Sincerely, Armin
OpenOffice 3.3/3.4 on various systems
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

Sorry to be absent from the discussion so long. I hope I can recheck my points listed above in the next months.
I noted some changes/improvements in SVG Import and PDF export in OpenOffice Windows Nightly May 30 02:30 1597981.
SVGs are exported as vector again to PDF and even transparent areas seem to be exported and show fine in PDF. Way to go!
Only thing I noted is that text/fonts placements in the SVGs are exported sometimes to different positions (horizontally) to PDF, see point (4) above - I know I'm picky ;-)
Thanks for your work on this alg!

EDIT: there seems to be a difference in the PDF export between AOO and LibO when there are certain effects like transparency in the SVG: AOO does export as pixels, LibO as vector.
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
User avatar
ChrisTi
Posts: 9
Joined: Fri Feb 01, 2013 3:40 pm
Location: Alps

Re: SVG Import/Support, PDF Export, Inkscape Compatibility

Post by ChrisTi »

PATTERN TEST
We are awaiting the good looking draft of SVG 2 including Hatches to become official and supported (see Inkscape Wiki, Blog of Tavmjong Bah and his SVG presentations: SVG 2 for Artists 2012, Future of SVG 2013).

Until then for technical charts, CAD-like drawings and cartography/maps with SVG we need to rely on the pattern function which is subject to anomalies at pattern boundaries.

I have tried to create a pattern test file including Seamless Patterns based on Cloned Tiles and have included PDF exports for Inkscape, AOO and LibO:
Inkscape seems to have optimized the problems patterns create and the PDF export is almost perfect;
AOO exports as pixel, because the Seamless Patterns based on Cloned Tiles may cause a transparency, but the content is exported? The same anomalies at pattern boundaries as in LibO are visible. The SVG without Seamless Patterns based on Cloned Tiles is exported as vector to PDF including the anomalies.
LibO exports as vectors; anomalies at pattern boundaries are visible. Seamless Patterns based on Cloned Tiles are not included.

Download Link for all files

Sample image from Inkscape:
Image
Attachments
SVG-Pattern-PDF.zip
(91.39 KiB) Downloaded 366 times
SVG-Pattern.zip
(12.24 KiB) Downloaded 364 times
OpenOffice 4.1 / 4.2.dev on Windows 7, Lubuntu 14.04, etc.
Post Reply