Greetings everybody,
I'd like to contribute to Batik and propose the following:
Hi Maik,
This is nice to know. In order to make contributions it is necessary to have a signed CLA (Contributors License Agreement) on file with the Apache Software Foundation.
Situation: I'm currently working on a project where SVG is being used to define layouts for labels that are being printed via Batik's PrintTranscoder. We define labels as individual SVGs and position them as embedded SVGs on a layout SVG which exactly has the dimensions of a DIN A4 page.
Problems with current Batik: (1) The PrintTranscoder _always_ centers the SVG on the page (thus disregarding the MARGIN_LEFT and MARGIN_TOP settings provided by the user).
Actually it accounts for all of the margins - it then scales and shifts the image to be centered in the page with those margins on the printable area. The problem with your patch is that it will ignore the MARGIN_RIGHT/BOTTOM settings - which is probably not good either.
Since we define _exactly_ where we want to print on the page it is undesirable in our situation that the PrintTranscoder does not follow our margin settings and in addition scales the image. This results in a printout that is different from the layout SVG.
Solution: I consider (1) a bug and propose the patch attached as "margin.diff" (in diff -u format)
I think 1 is a misunderstanding. Now I realize that it still causes you problems because if the aspect ratio doesn't match it will center (hence shifting the image on the page). However I am surprised that this causes you problems since your image should be matching the page Aspect ratio perfectly.
(2) The PrintTranscoder _always_ scales the SVG, either to max out the paper size or by using the PIXEL_UNIT_TO_MM key.
I consider (2) merely an annoyance and thus propose to introduce a new boolean key DISALLOW_SCALING which skips the scaling alltogether. I attached the patch as "scaling.diff" (in diff -u format).
Umm, why isn't PIXEL_UNIT_TO_MM exactly what you want? See you
_do_ want scaling since presumably your SVG isn't defined at printer
resolution (300dpi or 600dpi) what you seem to really want is to
turn off the 'scale to fit' behavior which is exactly what this
key does - in the processes it also allows you to control how the
SVG units are mapped to the device. In general you want something like: 28.3465 pixles/mm = 72 pixels/in (or 72dpi).
I think you can do what you want to with the existing PrintTranscoder - now I can understand that the margin specification may not be that convenient. But I think what you want is a KEY_PLACEMENT_X, KEY_PLACEMENT_Y which explicitly place the graphic on the page. These would have to disable the margin code which of course raises the issue of what to do about scaling (which I know you don't want and perhaps if either of these is set scaling could be set to the default of 72dpi).
I'm very interested in your opinion, please let me know if something is wrong with the patches.
Ask and you shall receive :)
Thanks, -Maik
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]