ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  SVG image size
Posted by Sam Leung on Aug-05-2011 00:44
Attachments:
I've tried embedding a SVG in a PDF document (with FOP), I specified the chart size to be 450 width and 225 height, the SVG generated by Chart Director does not seem to scale to the right size in the resulting PDF, it came out very small. When I manually added the width and height attributes to the <svg> element in the SVG file, the size came out correctly. See attached document to see the difference.

Is there any reason why the width & height attributes were not in the SVG in the first place?
Is there any way I can specify the attributes to be added in the SVG file?

Sam
SVG.doc
SVG.doc

125.50 Kb
original.svg
original.svg

31.97 Kb
withHeightWidth.svg
withHeightWidth.svg

31.97 Kb

  Re: SVG image size
Posted by Sam Leung on Aug-05-2011 00:49
Attachments:
Ihave attached the wrong SVG that has the attributes added, here is the correct one
withHeightWidth.svg
withHeightWidth.svg

32.00 Kb

  Re: SVG image size
Posted by Peter Kwan on Aug-05-2011 03:10
Hi Sam,

The chart is intentionally generated without a fixed size, so that users can resize it without having to regenerate the chart. (One of the main advantage of SVG is that it can be resized without losing details.) If the SVG does not have a size, then its size is determined by its container.

In a web page, if the SVG is contained inside a <DIV> block set to 600 x 300 px, then the SVG will be sized to 600 x 300 px. The user therefore can size the chart freely by sizing the containing DIV block.

In your case, you are generating a PDF. I am not sure how your PDF generating software sets the SVG size. If it is configurable like in a web page, you may configure your PDF generating software to use the size you want.

If your PDF generating software insists on using a small size for the SVG, you would need to use your own code to insert the width="xxx" and height="xxx" attributes. Simply search for the "<svg " text, and then insert the attributes there.

Hope this can help.

Regards
Peter Kwan