I'm an software dev and my job is to convert a .dxf file into a .svg file

My code actually works, but there are some issues with the dimensions or something similar. Unfortunately, i have no background in technical drawing whatsoever.

The finished .svg looks different from what expected.

When using an online .dxf to .svg converter it works. The .svg looks as expected from the customer.

My guess is that there seems to be something in the header of the .dxf file that I'm ignoring. I've read through several documents but i can't figure out why my .svg looks different.


enter image description here

What i am getting:

enter image description here

Its much smaller and its flipped. Ignore the color, i filled every hexagon on purpose! Looking at the converted .svg in detail, all coordinates are different from what it says in the .dxf

This is the header of the .dxf file:


$ACADVER: "AC1012"
$CLAYER: "0"
$DIMALTF: 0.0393700787
$DIMASZ: 3.5
$DIMCEN: 5.346
$DIMDLI: 22.572
$DIMGAP: 0.625
$DIMTM: 0.01
$DIMTP: 0.01
$DIMTXT: 3.5
$EXTMAX: {x: 594, y: 420, z: 0}
$EXTMIN: {x: 0, y: 0, z: 0}
$LIMMAX: {x: 594, y: 420}
$LIMMIN: {x: 0, y: 0}
$LTSCALE: 32.67
$PDSIZE: 0.05
$VIEWCTR: {x: 297, y: 210}
  • 3
    $\begingroup$ Dxf has a bottom corner coordinate where y is up. Which is common for physical mediums. Whereas svg has a top corner y is down measurement which is common for monitors because thats the refresh order of the screen. But to be honest this does not at all seem to be the right place to ask. $\endgroup$
    – joojaa
    Aug 19, 2020 at 10:16

1 Answer 1


SVG and images in general define a coordinate system with

  • positive x towards the right
  • positive y towards the bottom

I.e. the pixels with coordinate y=1 are near the top.

On the other hand dwg, defines a coordinate system with

  • positive x towards the right
  • positive y upwards

All you need to do is flip your svg along the x axis, either on the original or in the final svg.

  • 2
    $\begingroup$ You may also need to offset the if you use the extent info so it lays out somehow sane. But thats offcourse optional $\endgroup$
    – joojaa
    Aug 19, 2020 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.