1

I am create SVG files where I know the size of the canvas in inches. And I want set all coordinates in EMUs. And I am creating it in Batik which only allows setting the canvas size (width/height) in pixels and does not have a way to set the viewBox.

So my questions are:

  1. Is the viewBox the best way to handle the transformation from EMUs to inches? I prefer that to actually setting an AffineTransform as we need to use transforms at times.
  2. Using Batik is the best way to initially set the canvas size in EMUs (Batik will think it's pixels). Then create the SVG DOM. And when done, then change the DOM to set the canvas size in inches and add in the viewBox?
  3. When I set the viewBox values, with the canvas size explicitly in inches, how should I set the viewBox values? And will doing so then force all elements in the SVG to be processed as similar units?

thanks - dave

David Thielen
  • 28,723
  • 34
  • 119
  • 193
  • I don't know batik at all, but it seems you can set the viewBox attribute : `root.setAttributeNS(null, "viewBox", "0 0 800 600");`. Then you don't need units, everything will be in magicalSVGUnicornUnit, except for the root's width and height attributes. – Kaiido Aug 01 '16 at 01:56
  • See http://stackoverflow.com/questions/15335926/svg-viewbox-attribute – Robert Longson Aug 01 '16 at 07:26

0 Answers0