 					@cubic = SVG_cubic
 
 					@start = ->
-						@appendLine "<svg viewBox='0 0 #{doc.width} #{doc.height}' version='1.1' xmlns='http://www.w3.org/2000/svg'>"
+						@appendLine "<svg viewBox='0 0 #{doc.width*@scaleX} #{doc.height*@scaleY}' version='1.1' xmlns='http://www.w3.org/2000/svg'>"
 						@indent = "\t"
 
 					@appendPath = @appendPathSVG

		initClosureSwift: ->
			@result.push """
				{ #{@context}, #{@bounds} in
				\tlet verticalRatio: CGFloat = #{@bounds}.size.height/#{doc.height}
				\tlet horizontalRatio: CGFloat = #{@bounds}.size.width/#{doc.width}
				\tlet scale: CGFloat = verticalRatio < horizontalRatio ? verticalRatio : horizontalRatio
				\tCGContextTranslateCTM(#{@context}, (#{@bounds}.size.width-#{doc.width}*scale)*0.5, (#{@bounds}.size.height-#{doc.height}*scale)*0.5)
				\tCGContextScaleCTM(#{@context}, scale, scale)
			"""

		initClosureObjC: ->
			@result.push """
				^(CGContextRef #{@context}, CGRect #{@bounds}) {
				\tconst CGFloat verticalRatio   = #{@bounds}.size.height/#{doc.height};
				\tconst CGFloat horizontalRatio = #{@bounds}.size.width/#{doc.width};
				\tconst CGFloat scale = verticalRatio < horizontalRatio ? verticalRatio : horizontalRatio;
				\tCGContextTranslateCTM(#{@context}, (#{@bounds}.size.width-#{doc.width}*scale)*0.5, (#{@bounds}.size.height-#{doc.height}*scale)*0.5);
				\tCGContextScaleCTM(#{@context}, scale, scale);
			"""


		indent:     ""

		constructor: ( options ) ->
			width = +options.width
			height = +options.height

			if width and height
				@scaleX = width/doc.width
				@scaleY = height/doc.height
			else if width and not height
				@scaleY = @scaleX = width/doc.width
			else if height and not width
				@scaleX = @scaleY = height/doc.height
			else
				@scaleY = @scaleX = 1

			switch options.type
				when 'SVG'
