Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 610973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:44:00+00:00 2026-05-13T17:44:00+00:00

I try to auto-generate an SVG file intended to be printed on a certain

  • 0

I try to auto-generate an SVG file intended to be printed on a certain size (A4). I wish to use a path in it, which only allows ‘user units’, not ‘absolute units’.

It seems to me that it is impossible to ‘publish’ an SVG file that has absolute units (e.g. document size) and a path anywhere, because I cannot get it to work properly across viewers.

Is there a way to get some consistency in rendering, like specifying a ‘default DPI’?

Or put differently: Can I get my example below to render the same in all viewers without abandoning absolute units at all?

Related: Is there a way to force any of the applications below to render the image in the same way as one of the others? (E.g. I tried the -density option of ‘convert’, but I couldn’t get the output to match Inkscape’s or Firefox’ output.)


Example:

I’ve created one SVG file, with three black squares (rect) with a red diagonal (path):

  • Left: square and diagonal in user units
  • Middle: square and diagonal in inch (seemed to me the most logical choice, but is not allowed)
  • Right: square in mm, diagonal in user units

Which renders differently in different viewers:

  • Inkscape: 90 DPI, all squares same size, red diagonal matches
  • Firefox: 96 DPI?, latter squares to large (or diagonal to short)
  • Convert: 72 DPI, latter squares to small (or diagonal to long)

Code:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   version="1.1"
   width="200mm"
   height="100mm"
   >
  <g transform="translate(50,50)">
    <rect
       width="100."
       height="100."
       x="10"
       y="10" />
    <path style="stroke: #ff0000" d="M 10 10 L 110 110" />
  </g>
  <g transform="translate(200,50)">
    <rect
       width="1.111in"
       height="1.111in"
       x="0.1111in"
       y="0.1111in" />
    <path style="stroke: #ff0000" d="M 0.1111in 0.1111in L 1.111in 1.111in" />
  </g>
  <g transform="translate(350,50)">
    <rect
       width="1.111in"
       height="1.111in"
       x="0.1111in"
       y="0.1111in" />
    <path style="stroke: #ff0000" d="M 10 10 L 110 110" />
  </g>
</svg>

Inkscape (my default ‘viewer’):

Alt text

Firefox (note that the red line does not reach the lower right corner. I made a screenshot and cropped sort of arbitrarily):

Firefox

ImageMagick (convert, no options besides filenames given):

Alt text

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:44:00+00:00Added an answer on May 13, 2026 at 5:44 pm

    All dimensions in a path tag are in user units.

    You cannot specify absolute units within a path tag, which is why the path in the middle square does not render.

    The simplest way I have found is to set the units using viewbox:

    • Set the width & height in inches.
    • Then set the viewbox to be the same.
    • This sets the user unit to be one inch.
    • All sizes are then specified in inches (note: I used lower case l in path tag to specify a relative move)

    This displays correctly in Inkscape and Firefox.

    <svg
        xmlns:svg="http://www.w3.org/2000/svg"
        xmlns="http://www.w3.org/2000/svg"
        version="1.1"
        width="8in"
        height="4in"
        viewBox="0 0 8 4">
    
        <g transform="translate(4,0.5)">
            <rect
                width="1.111"
                height="1.111"
                x="0.1111"
                y="0.1111" />
            <path d="M 0.1111,0.1111 l 1.111 1.111" style="stroke: #ff0000;stroke-width:0.01"  />
        </g>
    </svg>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to auto generate method stub using visual studio's View.ShowSmartTag functionality When I
I'm extending an entity which doesn't auto generate its id. I want to 'override'
i try to use generate MVVM pattern using Silverlight ListView. But if i bind
I try to make an auto-update feature with my RSS reader application, so it
I try to save html content to the database, with ' or it auto
I have below variables try to make an auto generating SQL statement in python
I am trying to use Reflection.Emit to generate a wrapper class in a dynamic
This is my first try trying to use WCF, so I'm guessing I'm doing
I have a Java program that auto dials phone numbers, it can generate sounds
I am using WinXP. I use java to generate a list of files. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.