You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Irina Grigorieva <ir...@inbox.ru> on 2002/02/06 16:50:11 UTC

FOP & SVG precision; how to keep thin lines precision???

Hi,

I faced a problem. I need to generate barcodes (it is not a problem) and draw it into PDF.
That is, to draw several rectangles...
The FO document looks like:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox=http://xml.apache.org/fop/extensions>
...
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="300" height="300">
...
<svg:rect x="0" y="0" stroke-width="0" stroke="none" fill="black" height="50" width="1"/>
...
</svg:svg>
</fo:root>

When setting small _and_ fractional values to rectangle widths, they are displayed incorrectly:
the rectangles that should be the same widths differs in real widths about.. several times.

However, the value "1" is displayed correctly.

As far as I could understand, the problem is FOP precision is 72 dots per inch, that's why
any fractional values like 0.5..1.5 produces huge distortions.

Am I right? Is it a feature of SVG, a feature of FOP? Can I use something different than Batik for SVG?
Would generating images solve the problem of precision (if then place these images into PDF with FOP)?

Please help.

BR, Irina.


Re: FOP & SVG precision; how to keep thin lines precision???

Posted by Irina Grigorieva <ir...@inbox.ru>.
Thank you very much!!!
The trick you described works! I was able to print correct barcode using
transform attribute!

BR, Irina.
----- Original Message -----
From: "Keiron Liddle" <ke...@aftexsw.com>
To: <fo...@xml.apache.org>
Sent: Thursday, February 07, 2002 1:16 PM
Subject: Re: FOP & SVG precision; how to keep thin lines precision???


> Hi Irina,
>
> I'm no barcode expert but one I tried looked fine to me.
> Have you zoomed in on the barcode in the pdf document. If you view it
> normally the viewer may approximate the lines and therefore distort it.
>
> If there is still a problem maybe you could send a small fo and pdf to
> demonstrate the problem.
>
> An alternative may be to make the whole barcode larger, multiply by a
> factor of ten say. Then place the barcode in an svg transform. This way
> the values in pdf are less likely to be round off and the image will be
> scaled.
>
> On 2002.02.06 16:50 Irina Grigorieva wrote:
> > Hi,
> >
> > I faced a problem. I need to generate barcodes (it is not a problem) and
> > draw it into PDF.
> > That is, to draw several rectangles...
> > The FO document looks like:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> > xmlns:fox=http://xml.apache.org/fop/extensions>
> > ...
> > <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="300"
height="300">
> > ...
> > <svg:rect x="0" y="0" stroke-width="0" stroke="none" fill="black"
> > height="50" width="1"/>
> > ...
> > </svg:svg>
> > </fo:root>
> >
> > When setting small _and_ fractional values to rectangle widths, they are
> > displayed incorrectly:
> > the rectangles that should be the same widths differs in real widths
> > about.. several times.
> >
> > However, the value "1" is displayed correctly.
> >
> > As far as I could understand, the problem is FOP precision is 72 dots
per
> > inch, that's why
> > any fractional values like 0.5..1.5 produces huge distortions.
> >
> > Am I right? Is it a feature of SVG, a feature of FOP? Can I use
something
> > different than Batik for SVG?
> > Would generating images solve the problem of precision (if then place
> > these images into PDF with FOP)?
> >
> > Please help.
> >
> > BR, Irina.
> >
> >
>


Re: FOP & SVG precision; how to keep thin lines precision???

Posted by Keiron Liddle <ke...@aftexsw.com>.
Hi Irina,

I'm no barcode expert but one I tried looked fine to me.
Have you zoomed in on the barcode in the pdf document. If you view it 
normally the viewer may approximate the lines and therefore distort it.

If there is still a problem maybe you could send a small fo and pdf to 
demonstrate the problem.

An alternative may be to make the whole barcode larger, multiply by a 
factor of ten say. Then place the barcode in an svg transform. This way 
the values in pdf are less likely to be round off and the image will be 
scaled.

On 2002.02.06 16:50 Irina Grigorieva wrote:
> Hi,
> 
> I faced a problem. I need to generate barcodes (it is not a problem) and
> draw it into PDF.
> That is, to draw several rectangles...
> The FO document looks like:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:fox=http://xml.apache.org/fop/extensions>
> ...
> <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="300" height="300">
> ...
> <svg:rect x="0" y="0" stroke-width="0" stroke="none" fill="black"
> height="50" width="1"/>
> ...
> </svg:svg>
> </fo:root>
> 
> When setting small _and_ fractional values to rectangle widths, they are
> displayed incorrectly:
> the rectangles that should be the same widths differs in real widths
> about.. several times.
> 
> However, the value "1" is displayed correctly.
> 
> As far as I could understand, the problem is FOP precision is 72 dots per
> inch, that's why
> any fractional values like 0.5..1.5 produces huge distortions.
> 
> Am I right? Is it a feature of SVG, a feature of FOP? Can I use something
> different than Batik for SVG?
> Would generating images solve the problem of precision (if then place
> these images into PDF with FOP)?
> 
> Please help.
> 
> BR, Irina.
> 
> 

Re: FOP & SVG precision; how to keep thin lines precision???

Posted by Chuck Paussa <Ch...@systems.dhl.com>.
Irina Grigorieva wrote:

> Hi,
>
>  
>
> I faced a problem. I need to generate barcodes (it is not a problem) 
> and draw it into PDF.
>
> That is, to draw several rectangles...
>
> The FO document looks like:
>
We had the same problem and, after much playing with SVG and the example 
apps at http://www.renderx.com/barcodes.html we decided to purchase 
barcode fonts and embed those fonts in the PDF (Instructions at 
http://xml.apache.org/fop/fonts.html ) Barcode fonts are not expensive 
and the quality is excellent.

Chuck