nguyentruongnhan / evoluspencil

Automatically exported from code.google.com/p/evoluspencil
0 stars 0 forks source link

SVG export creating a box with incorrect dimensions #538

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a drawing that is not square
2. Export to SVG

What is the expected output? 
An SVG with dimensions matching the drawing.  So, if I load the SVG into 
inkscape, and tell it to fit the page to the content, then I get a page that 
fits what was in the original drawing.

What do you see instead?
An SVG that seems to use the width of the drawing as the height.  So when I do 
the above procedure in InkScape, the page ends up with a bunch of white space 
at the bottom (because my drawing is wider that it is tall).  This seems to 
manifest in two places in the SVG file.

What version of the product are you using? On what operating system?
Version 2.0.3 on Windows XP

Please provide any additional information below.
My source .ep file has 
[...]<Property name="width">1624</Property><Property 
name="height">1304</Property>[...]

The exported .svg has
<svg
   [...]
   width="1624"
   height="1624"
   [...]
  <g
     inkscape:label="Untitled Page"
     inkscape:groupmode="layer"
     id="layer_untitled_page">
    <g
       id="g4">
      <rect
         x="0"
         y="0"
         width="1624"
         height="1624"
         id="rect6"
         style="fill:none" />

The "rect6" object in particular is what's causing the problem for Inkscape.  
If I edit the height of rect6 to 1304 (the height from .ep), Inkscape behaves 
as I expected.

Original issue reported on code.google.com by dgasa...@gmail.com on 8 Feb 2013 at 8:09

GoogleCodeExporter commented 9 years ago
Correction: It appears the "rect6" object is something created by Inkscape, 
using the dimensions set on the <svg> object.  So now it appears the <svg> 
height is causing the problem.  If I edit the height attribute before opening 
in Inkspace, then everything works as expected.

Original comment by dgasa...@gmail.com on 8 Feb 2013 at 9:09

GoogleCodeExporter commented 9 years ago
More corrections (eventually I'll get it right :).  In the original exported 
SVG, the problem is a <rect> object:

<g inkscape:label="Untitled Page" 
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 
inkscape:groupmode="layer" id="layer_untitled_page"><g><rect x="0" y="0" 
width="1624" height="1624" fill="none"/>

So, please ignore the XML I pasted earlier.  In addition, I see know that the 
original <svg> has a different width and height, which doesn't seem to be 
related to canvas size:

<svg xmlns="http://www.w3.org/2000/svg" width="744.09448819" 
height="1052.3622047"

Original comment by dgasa...@gmail.com on 8 Feb 2013 at 9:25

GoogleCodeExporter commented 9 years ago
The size of the created SVG document appears to be coming directly from 
usr/share/pencil/content/pencil/exporter/Pencil2SVG.xslt, where it is hard 
coded as:
<svg width="744.09448819" height="1052.3622047"

So, either there is no code which is modifying these defaults to the correct 
dimensions for the document, or it is not working correctly.

Original comment by jay.ga...@DataMgmtSvcs.com on 25 May 2014 at 8:52

GoogleCodeExporter commented 9 years ago
This is a duplicate of issue #456.

Original comment by michiel....@gmail.com on 8 Jun 2015 at 8:01

GoogleCodeExporter commented 9 years ago
I attached a patch with a solution to issue #456.

Original comment by michiel....@gmail.com on 8 Jun 2015 at 9:01