SVG User Experiences

From Apache OpenOffice Wiki
Revision as of 18:23, 31 January 2006 by MilesTeg (Talk | contribs)

Jump to: navigation, search
OOoSVG-110.png
SVG Import
(external impl.)
Overview
Download
Source code
Features
Restrictions
FAQ
TODO
OpenDocument
Gradients
Group opacity
Elliptic arcs
Path semantics
Coordinate systems


Please add your feedback to this page by pressing the edit button at the bottom of the page! Before, you have to register (press the 'register' button in the menu to to the left). The registration is free and easy - and only required to prevent spam on the pages.

-- BernhardHaumacher - 18 Aug 2005

Import SVG in OO Writer as OLE Object

After installing the svg-import package I'm able to display a svg image as OLE object in OO Writer. My problem is, that the left top corner of the page where the graphics is on is displayed in the result in openoffice.


-- TheTschaena - 18 Oct 2005

Problem loading image

Hello, I tried to import a simple firewall picture from openclipart.org in my OpenOffice (1.9.130) over Fedora Core 2, but I get an "unknown format error" while I've successfully installed the svg-import-r2009 package. Is it because the image has some unsupported feature ? You can easily get the image by searching for "firewall" in the search engine of the main page of www.openclipart.org if needed (2 identical pictures found).

--

We are talking about http://openclipart.org/clipart/computer/firewall_denco_01.svg? I can "File/Open" that image with . You possible tried to "Insert/Picture/From File"? This is (currently) not supported by SVG import (see the post below). Open the image and Cut&Paste it into your document.

BTW. When loading this firewall image, it looks broken in - This cannot be completely explained with gradient problems and needs further evaluation.

-- BernhardHaumacher - 26 Sep 2005


Problems with transparency gradients

I tried your brand new version =svg-import-r2009.uno.zip= using OOo 1.9.124 (the build provided by Novell/SUSE) with Java 1.5.0_03 (part of SUSE Linux 9.3). The filter works quite good. Although differences to how Inkscape renders the sample image can be seen (screenshot, 132kB). The image is taken from [1].

-- ReneAuberger - 26 Aug 2005

This SVG image excessively uses transparency gradients. However, the result in Draw is that areas that should have been transparent are rendered black. My first impression was that this is a bug in Draw, but this is not the case. The filter in fact produces wrong results for transparency gradients, because I misinterpreted the specs for gradients and opacity. This will hopefully be fixed in the next release. Gradients seem to be most important for artistic images.

Rene, thanks for the hint!

-- BernhardHaumacher - 27 Aug 2005


Lenghty error message during Installation

I tried installing this package "svg-import-r2009.uno.zip") into OpenOffice 1.9.113 but got a java error at the very last stages of installation. (com.sun.star.uno.RuntimeException){ { Message = "[jni_uno bridge error] UNO calling Java method writeRegistryInfo: non-UNO exception occurred: java.lang.UnsupportedClassVersionError: haui/office/uno/filter/svgimport/Component (Unsupported major.minor version 49.0)X000ajava stack trace:X000ajava.lang.UnspportedClassVersionError: ~ looks like a bunch stuff I cannot afford to type it all in by hand - more than 2000 chars of stack trace.

Ok, so I went to OpenOffice and downloaded OpenOffice 1.9.125. When I went back in it said the component was already installed. Ok, so i uninstalled it and tried reinstalling the component, and i got the same error. Anyway, after installation I tried to open an SVG document and it opened the document in the Word program ~ not in the draw program.

The Package Manager says that "draw_svg_Import.xcu" and "svg-import.jar" are both "Disabled" and there is no way to enable them !

-- DonaldGillies - 03 Sep 2005

The error with the lenghty message is due to an insufficient Java version being installed. The SVG import requires at least jre/1.5. The plugin should give a more informative error message here, sorry.

You can download Java 5 from [2] for many platforms.

The plugin should work fine with OpenOffice 1.9.113, but now, you already have 1.9.115. That's fine. This did not help, because you still had the wrong Java version installed.

-- BernhardHaumacher - 04 Sep 2005


Graphic not editable after import

Ok, so i figured out I needed batik, and managed to find it, but i struggled for an hour to install batik. I didn't realize at first that you needed to install batik with the open office package manager. after i finally got batik, and java 5.0, and svg import enabled, i find that when i open an SVG picture in open office, it appears as a single object (like a groupped object ~ that cannot be ungroupped) that cannot be split - just like it always did before !! I'm frustrated !!

-- DonaldGillies - 03 Sep 2005

To the best of my knowlege, you do not need to separately install batik, because the relevant batik classes are included in the plugin. But of cause, you need Java 5. That's the reason, why things changed upon your third attempt.

If you now open an *.svg with OpenOffice, Draw opens and displays the image, am I right? The plugin in the package manager is enabled now, isn't it? That's great, because the filter seems to work now.

The imported image should be editable in Draw. You say, you cannot ungroup the object. You clicked the object and selected "ungroup" from the context menu, but nothing happended? The reason may be that there are several levels of grouping in your SVG image. Just try to repeat the procedure several times: Select the image and select "ungroup" from the context menu, until "ungroup" is no longer available. Afterwards, you can deselect the image and select arbitrary parts thereof.

-- BernhardHaumacher - 04 Sep 2005

No SVG Insert via Insert/Picture/From File

I'm using OO.o 1.9.129 under UbuntuLinux 5.10 Breezy Badger. I installed the sun java 1.5.0_05, and it's seen under OO.o Options->OpenOffice.org->Java and it's chosen as the default (ignoring the gnu 1.4 version which comes std with Ubuntu). I then installed svg-import-r2009, which went smoothly: PackageManager reports that all three pieces are installed and enabled. I restarted OO.o (and checked ps to make sure that the process was really killed and restarted).

However, when I open a new doc and attempt to import an svg, there are two problems. I go to Insert->Picture->From File, and in the chooser menu there's no svg in the extension list, so directories that contain svgs show nothing. I got around that by naming the file directly. OO.o then gives an "unknown graphic format" message.

I tried this using svgs from the Ubuntu "Human" icon set, and some svgs of statistical graphics using pstoedit from eps files. Same results.

I started oofffice2 from the bash cmd line, but there's no helpful tracing coming out. Any ideas about what I could check next? thanks in advance, and thanks for this -- SVG *is* what we need to do for serious graphics in docs.

--

The SVG import filter only works in Draw for opening SVG graphics for editing. Try File->Open and select the graphic you want to load. This should open a new Draw window with the desired graphics loaded. If you only want to include the graphics into a writer document, you may select the whole image and transfer it with Cut&Paste from the draw window to your document.

-- BernhardHaumacher - 26 Sep 2005

Problem loading SVG image

I tried to open an SVG file in OpenOffice Draw and it is different from what we have with Inkscape. File : http://openclipart.org/clipart//computer/mouse_the_structorr_.svg.

Anyway, thx a lot for all the work that has been done with openoffice SVG package. It is now possible to use openclipart gallery in OpenOffice!

-- CyrilJacquenot - 27 Sep 2005

Thanks for this nice example! This looks really broken when imported into . The problem is due a combination of opacity and color gradients. Both are not supported well by the current filter version. It will be worthwile to check this image with the next version. Unfortunately, I will not have time to complete the improved transformation for gradients before October 25th :-).

-- BernhardHaumacher - 28 Sep 2005

I understand that you are complety full in your timetable and it's such a great thing that our requests are taken into consideration... Thx for your answer and I'll be waiting for the next version... I like openoffice and opencliparts!

-- CyrilJacquenot - 14 Oct 2005

Misplaced characters and *eps import*

I tested the import filter on a small set of .eps files converted through pstoedit (.sk) then Inkscape to .svg. All look good. Congratulations and thanks for the work. It looks like a workable fix to the nagging poor handling of vector images in OOo, at least for simple enough things like 2d scientific graphs/plots, requiring some manual edition for labelling etc...

However I found an hopefully minor glitch: text are somewhat misplaced i.e. shifted from their correct position. This can be seen using a very simple drawing made with Inkscape: a small text and some vertical and horizontal lines matching vertical and horizontal features of the text. Then import in OOo. The drawing looks fine but lines and text are offset.

NB1: I use Helvetica fonts, Inkscape-0.41-1, jre1.5.0_04, OOo 2.0 (official rpm) and svg-import-r2009.uno.zip NB2: a *work around* in Inkscape: Edit/Select all then Object/Ungroup then Path/Object to Path and save using Inkscape svg format. This can now be imported into OOo draw.

-- JacquesRoux - 01 Oct 2005


I can confirm this issue. Text placement in OpenDocument graphics is somewhat vague and needs further evaluation. Nevertheless, improved text placement is on the SVGImportTodo list.

-- BernhardHaumacher - 12 Oct 2005


Problems importing from Visio save

Slight problems importing .svg saved from MS Visio 2003 - certain entities are not displayed in Draw. The attached file presumably contains these entities, since I can re-import it into Visio and it displays as expected. The Gimp also detects the entities concerned.

-- MartinTaylor - 06 Oct 2005

Thank's for this example graphics, "slight" seems to be understatement so. Unfortunately, MS Visio uses some SVG "extensions" to encode the icons as proprietary (?) binary-encoded metafile. As replacement, only a low-resolution bitmap is provided, which is not imported by the filter.

Even if the filter would support embedded bitmaps in SVG files, the imported result would be inferior, because small bitmaps neither scale nor print well. Without enhancing the filter to also convert the embedded "metafile" to OpenDocument, there is no chance to produce acceptable results from those Visio "SVG exports".

Here is a link to some more information about Visio SVG export and import:

http://www.svgopen.org/2003/papers/SVG_Scenarios_using_Microsoft_Office_Visio_2003/

-- BernhardHaumacher - 07 Oct 2005


I understand what you're saying. Having skimmed through the MS document, I've had a look at the SVG with a hex editor, and I see where the metafiles occur. It occurs to me that these metafiles are almost certainly in WMF format, and that OOo includes code to deal with WMFs. I can well understand that you might have little interest in incorporating into your SVG filter any code to deal with non-SVG entities, but... Presumably at some point your filter code is likely to form the basis of a filter built into OOo 2.x. Would you foresee that at that time it might be possible for the filter to make use of the existing WMF filter code in order to convert the whole thing more completely to OpenDocument, as per your second paragraph above?

-- MartinTaylor - 09 Oct 2005


It would be a special pleasure for me to enable a perfect import of Visio drawings, since Draw is a direct competitor to it. I extracted a metafile from your SVG-exported Visio drawing and base64-decoded it. Unfortunately, it does not look like a plain WMF (see the attached file /Topologyanon.svg.meta Topologyanon.svg.meta). Unix file type detection reports "data", and I'm not able to load this file e.g. in Draw. Could you help unraveling those mysterious metafiles? Are you able to load the extracted metafile in any M$-Products?

-- BernhardHaumacher - 10 Oct 2005


I'm unable to open that file in MS Visio, MS Paint, Windows Picture & Fax Viewer, Gimp or Dia. One thing I notice, however, is that some Visio diagrams in my possession do open successfully as SVGs in Draw - I attach an example. It may be that the key here is in the nature of the original Visio shapes used to construct the drawing. I will see whether I can establish anything useful on this question.

-- MartinTaylor - 10 Oct 2005


Maybe, these drawings contain only bitmap icons even in the Visio source. Then, enabling bitmap import will produce a comparable drawing in . The image you attached that is imported correctly contains an embedded SVG image as replacement for the mysterious metafile. SVGs embedded in SVGs are handled correctly by the import filter.

Bitmap import is on the SVGImportTodo list.

-- BernhardHaumacher - 12 Oct 2005


r2131 is a great improvement as regards importing Visio drawings. The only major problem in this area that I see right now is that where text in a Visio text box contains returns (thus giving multiple lines of text), when imported into Draw the returns seem to be lost. The result is that text boxes end up overlaying each other on the screen, and are effectively unreadable.

-- MartinTaylor - 19 Jan 2006

SVG file stays locked after import

Also the .svg file remains open in soffice.bin even after Draw has been closed, which causes problems if I re-open it using a different application. Not sure if this is a filter issue, though...

-- MartinTaylor - 06 Oct 2005


PS I confirm that SVG files stay open in soffice.bin after Draw is closed, though other types of drawing file are closed with the application. I presume that this really is a filter issue.

-- MartinTaylor - 10 Oct 2005


I can confirm this issue. Even if the file is not locked on Unix after import, there is an open file handle that stays open until is closed. I tried a quick fix, but this did not help. Therefore, it's another item on the SVGImportTodo list.

-- BernhardHaumacher - 12 Oct 2005


allow text scaling (draw:fit-to-size="true")

If an svg contains text, then that text is not scalable when imported into writer. This has also the unpleasant side effect that the image is incorrectly aligned with the page. A correctly aligned, scalable image is obtained by adding the tags

draw:auto-grow-width="false" draw:auto-grow-height="false" draw:fit-to-size="true"

to the text frame style.


-- Gerd - 09 Dec 2005

PS: I only found an edit button at the top  ;-)


Topologyanon.svg MS Visio drawing exported to SVG.

Topologyanon.svg.meta Extracted and base64-decoded metafile embedded in Topologyanon.svg

Network20041207.svg

Installing SVG and Java 1.5

I've installed the SVG filter into the Novell Version of OpenOffice 2.0 that came with SuSE 9.3. There were some minor problems.

First SuSE 9.3 comes with Java 1.4.2, so to install the new filter I needed to download version 1.5.0. I found that the java.sun.com site (given above) had information on installing the system (see http://java.sun.com/j2se/1.5.0/jre/install-linux.html), but to actually download java 1.5 it is necessary to go to www.java.com.

Second was the question of where to unpack the distribution. SuSE places java 1.4 under /usr/lib/jvm. For files which are not part of the main distribution the Filesystem Hierarchy Standard recomends /usr/local. I created a directory java under this and installed java 1.5 there. OpenOffice then found the distribution there without any problem.

I downloaded the SVG filter file svg-import-v2131.uno.zip, but then made the error of unzipping the file before adding the macros to OpenOffice. Each of the three macro files then has to be added separately for the system to work. A better method, which OpenOffice supports, is to import the whole zip file.

Took a bit of time but the result is really worthwhile. Thanks guys.

-- David Webb - 7th January 2006

p.s. All I need now is a way of directly importing ps and eps files which allows me to edit individual lines within OpenOffice.

Problem with the 'path' operator

I have found what looks like a rounding error when processing the path operator. The following svg file plots a box of width 77.6 and a path made up of 100 segments each with an x-coordinate step of 0.776. Thus the path should lie within the box. When imported into OpenOffice it is found to extend beyond the right hand side of the box.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [ <!ENTITY ns_svg "http://www.w3.org/2000/svg"> ]>
<svg width="400" height="100" viewBox="0 0 400 100" overflow="visible" enable-background="new 0 0 400 100" xml:space="preserve">
<path fill="none" stroke="#000000" stroke-miterlimit="10" d="M10.000,5.000v80.000h77.60V5.000H10.000"/>
<path fill="none" stroke="#000000" stroke-miterlimit="10" d="M10.000,40.000
l0.776,0.200l0.776-0.200l0.776,2.432l0.776,3.070l0.776,4.663
l0.776-5.669l0.776-5.786l0.776-0.143l0.776-1.883l0.776,1.617
... Two lines together containing 10 coordinate pairs repeated 9 more times ...
"/>
</svg>

-- David Webb - 12th January 2006

Further comments

I've looked at the problem further and concluded that it arises because the test problem draws a long line of small increaments in the x-direction (i.e "l x-increment,y-increment" instead of "L x-value,y-value"). The SVG filter transforms the SVG pixel (96 pixels = 1 inch) values correctly to OpenOffice units (1 unit = 0.01 mm) but OpenOffice then appears to round each increment value to the nearest number of whole units before adding it to the previously plotted point and plotting the next point. The error observed in the above and other related problems (sometimes the path is too short) is consistent with this explanation. The sum of rounding errors is insignificant for simple shapes with a few points but with long time series with hundreds or thousands of regularly spaced points it becomes significant.

The best solution is for OpenOffice itself to support fractional units - at least while it is processing input in the form of increments. The alternative (practical) solution is to modify the filter to do this, converting the list of increments to a list of absolute coordinates and, to be sure, to make its own conversion to the nearest integer.

Unfortunately my knowledge of Java is not up to working through all the implications of any code changes but if anyone wants a go, the string to convert is the string 'result' in 'getPathSegmentsAsString' in file 'svg2office/src/haui/xml/svg/transformation/SVGToOffice.java'. The case where the inital point is given relative to svg:x and svg:y also needs to be covered - plus the more complex svg path commands and any changes to the bounding box.

-- David Webb - 30th January 2006

SVG filter on Mac OS X

I have been able to add the import filter into OOo 2.0.1 on Mac OS X 10.4.3 with JRE 1.5.0. Some preliminary findings are below.

  • Experiments with SVG exported from OmniGraffle have been less than promising, but I'm still tinkering...
    • OG file export to SVG and OOo import of a fairly simple OG flowchart was taking forever (killed process)
    • OG graphics imported to OOo are not in nearly the same proportion I see on the screen in OG... Much bigger.
    • Hopefully this link works... File:OG4 High Level Process Map v2.svg The wiki didn't seem to like the SVG attachment.
  • Inkscape seems to work OK, but there are some quirks:
    • Unexpected shape sizes (again, much bigger)
    • Unexpected page borders for the canvas (probably a setting in Inkscape I need to find)
    • etc...
  • I ran some very limited, quick tests with Open Clip Art SVG files and things worked well.

I will post more when time allows.

Thanks to the developer and everyone helping improve this utility.

--EJ 10:09, 20 January 2006 (CET)


Website locked down?

I tried to find your SVG Import Filter, but I doesn´t have permission to enter the website: http://www.ipd.uka.de/~hauma/svg-import/ --MilesTeg 19:23, 31 January 2006 (CET)

Personal tools