Created attachment 53648 [details] Diamond Shape in DRAW Perhaps this is not an error, but it should not be the default behavior. When an SVG picture is generated within DRAW then the exported SVG "Image Size" is HUGE. As an example, we tested the desired functionality in the Master: LibO-dev 3.5.0 Build ID: 8f87c3d-5d03837-adcf6d5-c4bb9bd On OSX 10.6.8 Located at: http://dev-builds.libreoffice.org/daily/MacOSX_10.6.7_Intel_no-moz/master/2011-11-16_01.40.47/ with master~2011-11-16_01.40.47_LibO-Dev_OOO350m1_MacOS_x86_install_en-US.dmg Steps to reproduce: 1. Start LibreOffice and choose File -> New -> Drawing. 2. At the bottom of the window, click on the Basic Shapes tool (in this case the diamond shape). 3. Draw a small Diamond shape. 4. Select File -> Export... 5. Enter a file name (we used Diamond Shape). 6. Choose File Type of SVG. 7. Save the SVG file. 8. Open the saved SVG file with any "robust" Text-Editor (Please see the SVG results below.) Expected results: A moderately sized SVG picture that is generated from a default page size of 8.5 by 11 inches with a picture that will remain scalable within WRITER, DRAW, etc. Actual results: An SVG picture with a size of 287.87 by 372.53 inches when calculated at 75 Dots-Per-Inch (DPI); 21590 by 27940 pixels RAW. Here is the actual SVG: <?xml version="1.0" encoding="UTF-8"?> <svg version="1.2" baseProfile="tiny" viewBox="0 0 21590 27940" preserveAspectRatio="xMidYMid" fill-rule="evenodd" clip-path="url(#presentation_clip_path)" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> <defs> <clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse"> <rect x="0" y="0" width="21590" height="27940"/> </clipPath> </defs> <g id="id2" class="Master_Slide" clip-path="url(#presentation_clip_path)"> <g id="bg-id2" visibility="visible" class="Background"> <rect fill="none" stroke="none" x="0" y="0" width="21590" height="27940"/> </g> <g id="bo-id2" visibility="visible" class="BackgroundObjects"/> </g> <g id="id1" class="Slide" visibility="visible" clip-path="url(#presentation_clip_path)"> <g class="com.sun.star.drawing.CustomShape"> <g> <path fill="rgb(207,231,229)" stroke="none" d="M 12747,6714 L 14081,8429 12747,10144 11413,8429 12747,6714 12747,6714 Z M 11413,6714 L 11413,6714 Z M 14081,10144 L 14081,10144 Z"/> <path fill="none" stroke="rgb(128,128,128)" d="M 12747,6714 L 14081,8429 12747,10144 11413,8429 12747,6714 12747,6714"/> <path fill="none" stroke="rgb(128,128,128)" d="M 11413,6714 L 11413,6714"/> <path fill="none" stroke="rgb(128,128,128)" d="M 14081,10144 L 14081,10144"/> <rect fill="none" stroke="none" x="11414" y="6715" width="2668" height="3430"/> </g> </g> </g> </svg> Please note that HUGE pictures are not needed with Scalable Vector Graphics (SVG) because SVG is supposed to be consistent and reliable at every size. See attachment of screenshot of Diamond Shape used. Thank you.
To be honest: I do not know what unit is behind values of "width", "height" "viewbox". Often "px" seems to be expected. I never had problems with that as long as relation of dimensions of viewbox, width and height are appropriate. The vector graphic will be scaled by the viewer or application where the graphic will be inserted. @rk601@yahoo.com Please always attach the original .dwg and the result.svg. We know the tricks how to read the source code of a .svg I doubt that you wanted to create a svg containing a white letter size area with a small diamond shape in it, but a diamond shape? That's impossible because of "Bug 43129 - FILESAVE: Export selection to SVG, WMF shows all page content"
Due to missing complete problem description.
It seems some other software (like Wikimedia, wee "Bug 42719 - WIKI: SVG PNG preview creation broken") might have problems with the LibO SVG dimensions, so REOPENED.
The problem is http://opengrok.libreoffice.org/xref/core/filter/source/svg/svgexport.cxx#771 771 // enabling _SVG_WRITE_EXTENTS means that the slide size is not adapted 772 // to the size of the browser window, moreover the slide is top left aligned 773 // instead of centered. 774 #undef _SVG_WRITE_EXTENTS 775 #ifdef _SVG_WRITE_EXTENTS 776 aAttr = OUString::valueOf( nDocWidth * 0.01 ); 777 aAttr += B2UCONST( "mm" ); 778 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", aAttr ); 779 780 aAttr = OUString::valueOf( nDocHeight * 0.01 ); 781 aAttr += B2UCONST( "mm" ); 782 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", aAttr ); 783 #endif I.e. the export explicitly doesn't set the real size (as indeed browser does use the specified size and doesn't scale), but only sets the viewBox size - but it doesn't use pixel-units (as all other tools assume when "user units", i.e. values without unit) are used. So to fix the files, change <svg version="1.1" viewBox="0 0 21000 29700" to <svg version="1.1" width="210mm" height="297mm" viewBox="0 0 21000 29700" i.e. the viewBox uses 1/100th of a millimeter, so it is easiet to specify the width and height in mm. So easiest fix is to export the actual dimensions of the canvas and live with webbrowsers not scaling the svg to fit the screen. Add Marco Cecchetti to cc as he was the one who disabled writing the extents.
another way to solve is is to use the scaling factor of 0,03543307 to convert the ViewBox to px (i.e. what all other tools have to assume when the unit is missing) and also specify that factor as a transform="scale(0.03543307)" attribute to each layer/page. In the following example, I only added it to the "Slide" page, as the "Master slide" one is empty and thus not needed to demonstrate it, but it really should be there as well. * note viewBox="0 0 744.09447 1052.362179" in the svg tag → 210mm x 297mm converted to px (assuming 90dpi) * note the transform="scale(0.03543307)" to apply the same factor to the coordinates used in the actual drawings. this svg just has two default-blue rectangles in the upper half of a A4 page: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1" viewBox="0 0 744.09447 1052.362179" preserveAspectRatio="xMidYMid" fill-rule="evenodd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g visibility="visible" id="Standard"><desc>Master slide</desc><g style="stroke:none;fill:none" ><rect x="0" y="0" width="21000" height="29700"/></g></g> <g visibility="visible" id="page1" transform="scale(0.03543307)"><desc>Slide</desc> <g><desc>Drawing</desc> <g> <g style="stroke:none;fill:rgb(153,204,255)"><path d="M 5000,6500 L 2000,6500 2000,3000 8000,3000 8000,6500 5000,6500 Z"/></g> <g style="stroke:rgb(0,0,0);fill:none"><path style="fill:none" d="M 5000,6500 L 2000,6500 2000,3000 8000,3000 8000,6500 5000,6500"/></g> <g/> </g> </g> <g><desc>Drawing</desc> <g> <g style="stroke:none;fill:rgb(153,204,255)"><path d="M 13000,9000 L 9500,9000 9500,6000 16500,6000 16500,9000 13000,9000 Z"/></g> <g style="stroke:rgb(0,0,0);fill:none"><path style="fill:none" d="M 13000,9000 L 9500,9000 9500,6000 16500,6000 16500,9000 13000,9000"/></g> <g/> </g> </g> </g> </svg>
reproduced in 3.5.0 rc 3 on Fedora 64 bit A4 in Draw, saved as svg, becomes approximately 6 X 8 Meters size with 3.3.4 the same problem, change version to it
confirmed in 3.4.5 on archlinux 32bits huge svg is imported without problem into Inskape. but when I export it with Inskape, it still has this huge size. If I resize the image before exporting it in Inkscape, I got an image with at 3ppi. How this mess is possible with SVG, that is supposed to scaled agnostic ?
Thanks for the fix - I assume that it will also be used when "only selection" is exported? if you write fdo#43060 instead of "bug 43060" somewhere in the first line of the commit message, the checkin would be announced automatically :-) ####### Marco Cecchetti committed a patch related to this issue. It has been pushed to "<master|release-branch>": http://cgit.freedesktop.org/libreoffice/core/commit/?id=d6b82f7bcb5123db56eb9acf4a3f3c2c90319606 In order to fix bug 43060 the width and height attributes are exported with units (mm) for the <svg> element when a single slide/page is exported. It will be available in <whatever version the release-branch it did land in ends up>. ##### (so far it has only been added to master, so still needs to be cherry-picked for libreoffice-3.6) http://wiki.documentfoundation.org/Development#Bugzilla-integration_with_commit-messages
On Fri, 15 Jun 2012 14:14:01 +0200, <bugzilla-daemon@freedesktop.org> wrote: > https://bugs.freedesktop.org/show_bug.cgi?id=43060 > > --- Comment #8 from Christian Lohmaier <lohmaier@gmx.de> 2012-06-15 > 05:14:01 PDT --- > Thanks for the fix - I assume that it will also be used when "only > selection" > is exported? The "only selection" option has no effect at present. You can export a subset of presentation slides only by selecting them in the slide sorter view. In such a case the selected subset is exported independently by the "only selection" check box state. So as the commit message says : "the width and height attributes are exported with units (mm) for the <svg> element when a *single* slide/page is exported" that looks to me a good compromise. > if you write fdo#43060 instead of "bug 43060" somewhere in the first > line of > the commit message, the checkin would be announced automatically :-) Thanks for having pointed out that. :-) Cheers, -- Marco
Oh, I didn't mean a selection of slides, but rather only part of a single slide. (mainly targeting at draw here, not impress). Let's say you have 5 Objects on a draw page, but only select two for export.
Still an issue for Fedora 18, LibreOffice 3.6.7.2 release: $ rpm -q libreoffice-draw libreoffice-draw-3.6.7.2-4.fc18.x86_64 My usecase is an export of a single-page .odg (i.e. a single file with just one page), page formatted at A4, to .svg. Then I tried to include the .svg in LaTeX, but got complains about dimension too wide. Checking in Inkscape, the resulting .svg was 29700px by 21000px, hence the complaints.
Thanks for additional testing. In 4.1.3 problem already fixed. If possible, please, upgrade to Fedora 20 or to LO 4.1
Setting to WORKSFORME as of Comment 12. Please update to a recent OS and/or LO version 4.1.x or 4.2
https://cgit.freedesktop.org/libreoffice/core/commit/?id=d6b82f7bcb5123db56eb9acf4a3f3c2c90319606