I am trying to fit a barcode image into a FOP 0.20.3 document (PDF). The
image is much bigger in the PDF (screen or printed) than when i view it
into an imaging tool.
I have a constraint on the barcode image that make it impossible for the
width to be less than about 250 pixels (I need to put 17 characters on
this barcode). I can decrease this value a bit but not much.

Pixels are well suited for bitmaps and stuff that has naturally, well, pixels, like monitors. The concept breaks down when stuff is rendered to continuous media, like paper. You use measurements like centimeters in this case. When you supply a bitmap, a factor of 1/72 inch/pixel is used to calculate width on paper from pixel measurements. SVG is vector graphic. You can use cm or mm for measurements there as well. Your SVG should specify a height and width in cm or mm or in or pt. Use the same height and width on the fo:external-graphics or fo:instream-foreign-object holding the SVG: <fo:instream-foreign-object width="5cm" height="1cm"> <svg:svg xmlns:svg="http://www.w3.org/2000/svg"; width="5cm" height="1cm"> <svg:g stroke="black" stroke-width="0.8mm"> <svg:rect fill="none" width="5cm" height="1cm"/> </svg:g> </svg:svg> </fo:instream-foreign-object>

There are perhaps some round-off errors and some clipping issues.
The SVG content should stay away a bit off the edge of the
containing rectangle, and you should print it, not judge how
it is rendered on screen.

I also tried setting content-width and content-height to 50% but then FOP
complains that "No conversion is defined". Seems to be it won't get the %
Neither of these properties are currently implemented, and
it wouldn't help anyway.


Reply via email to