Bug 100492 - SVG export adds extra arrow heads
Summary: SVG export adds extra arrow heads
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.1.4.1 rc
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
QA Contact:
URL:
Whiteboard: target:6.0.0 target:5.4.2
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-20 06:25 UTC by Laurent Godard
Modified: 2017-09-13 06:46 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
the docx file (51.29 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-06-20 06:25 UTC, Laurent Godard
Details
expected (13.83 KB, image/png)
2016-06-20 06:26 UTC, Laurent Godard
Details
svg export with extra arrows (15.35 KB, image/png)
2016-06-20 06:26 UTC, Laurent Godard
Details
the svg file itself (9.25 KB, image/svg+xml)
2016-06-20 09:26 UTC, Laurent Godard
Details
writer file with macro to reproduce (20.53 KB, application/vnd.oasis.opendocument.text)
2016-06-27 06:58 UTC, Laurent Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Godard 2016-06-20 06:25:41 UTC
Created attachment 125748 [details]
the docx file

after DOCX import (with problems, see #100491)

exporting to SVG adds extra arrows
Comment 1 Laurent Godard 2016-06-20 06:26:05 UTC
Created attachment 125749 [details]
expected
Comment 2 Laurent Godard 2016-06-20 06:26:34 UTC
Created attachment 125750 [details]
svg export with extra arrows
Comment 3 Laurent Godard 2016-06-20 09:26:02 UTC
Created attachment 125768 [details]
the svg file itself

the previous attachment is a png shoot of this svg file
Comment 4 Buovjaga 2016-06-26 10:37:18 UTC
How can I export it to SVG? File - Export does not give me the ability and neither does right-click context menu.
Comment 5 Laurent Godard 2016-06-26 11:55:51 UTC
Hi

(copy/paste to draw + right clik on the graphic should allow you to export)


currently, this is done using uno api (pyUNO)

obj is a graphic (in writer), doc is the writer document
eg.

obj = doc.getDrawPage().getByIndex(0)

        export_engine = smgr.createInstanceWithContext(
            'com.sun.star.drawing.GraphicExportFilter', ctx)
        extension = '.svg'
        mimetype = 'image/svg+xml'

        export_engine.setSourceDocument(obj)

        url = unohelper.systemPathToFileUrl(
                    os.path.join(out_dir_path, obj_file_name))
        args = (PropertyValue('URL', 0, url, 0),
                        PropertyValue('MediaType', 0, mimetype, 0))

        export_engine.filter(args)

feel free to ask if anything not clear
Comment 6 Buovjaga 2016-06-26 12:15:30 UTC
I pasted it to Draw. No right-click option, but used File - Export + Selection.
I don't get the result shown in attachment 125768 [details]. I get the same as shown in LibO.

I wonder, if the problem is with your Python thing. Did you try from Draw?

64-bit, KDE Plasma 5
Build ID: 5.1.4.2 Arch Linux build-1
CPU Threads: 8; OS Version: Linux 4.6; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)

Arch Linux 64-bit, KDE Plasma 5
Version: 5.3.0.0.alpha0+
Build ID: ff25ea3d5ccf3a990767cbb1ef99037d3f84b072
CPU Threads: 8; OS Version: Linux 4.6; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on June 26th 2016
Comment 7 Laurent Godard 2016-06-27 06:47:26 UTC
Hi 

Thanks a lor for your investigation

I confirm that doing manually (copy-paste to draw  + export selection), the exported svg is the same as what is displayed in LibreOffice

So the problem seems to be using GraphicExportFilter from Writer using UNO
Comment 8 Laurent Godard 2016-06-27 06:58:22 UTC
Created attachment 125935 [details]
writer file with macro to reproduce
Comment 9 Laurent Godard 2016-06-27 07:02:12 UTC
Please find attached an odt file with a macro to reproduce

enable macros, click the button
the file will be saved at the same place than original file

then note that the exported svg arrows are different than the (though wrongly as reported in #100491) original ones

feel free to ask if anything more needed
Comment 10 Buovjaga 2016-06-27 08:28:30 UTC
(In reply to Laurent Godard from comment #8)
> Created attachment 125935 [details]
> writer file with macro to reproduce

Repro with macro.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.3.0.0.alpha0+
Build ID: ff25ea3d5ccf3a990767cbb1ef99037d3f84b072
CPU Threads: 8; OS Version: Linux 4.6; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on June 26th 2016
Comment 11 Armin Le Grand (CIB) 2016-09-30 13:19:07 UTC
Basic difference between
(a) export from copied shape in draw/impress and
(b) executing the macro
that
(a) does the 'big' svg exporter using UNO API, traveling over document/pages/shapes and exporting each as single shape (much better structured SVG), while
(b) uses the GraphicExportFilter after fetching a single Metafile of all contained objects (raw geometry, bad structured SVG).
Both land in SVGActionWriter::ImplWriteActions to write the metafile. Interstingly while (a) has the correct LineStart/End infos in the single Metafiles per object, (b) seems not to have that. Question is where these extra-Arrows come from. Looking into it...
Comment 12 Commit Notification 2017-08-29 10:43:27 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d3f1fa3cf190b83d585ec3d1b1a8e5b0896c8ea1

tdf#100492 Skip empty shapes in SVG export

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2017-09-01 10:57:24 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=52f0d67e9756d81032c4b73fbb3e0aefe053e41d&h=libreoffice-5-4

tdf#100492 Skip empty shapes in SVG export

It will be available in 5.4.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.