xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bartosz Celmer <JOHN...@idea.net.pl>
Subject PrintTranscoder.KEY_AOI problem posible bug
Date Wed, 16 Jun 2004 10:24:50 GMT
 

Hello 

I'm trying to use Batik project to print SVG documents, but I need to print
only part of them. I tried to use PrintTranscoder.KEY_AOI, but I doesn't
work. When I set a rectangle which I want to print either nothing is being
printed, or the printed area is different from the one I choose. Here is the
code I use to print: 

 

 

private void print()

 {    

    new Thread() {

      public void run(){ 

      Rectangle aoi = new Rectangle(0,0,200,200);

      PrintTranscoder pt= new PrintTranscoder();

 

        pt.addTranscodingHint(PrintTranscoder.KEY_WIDTH,

                                 new Float(aoi.width));

       pt.addTranscodingHint(PrintTranscoder.KEY_HEIGHT,

                                 new Float(aoi.height));      

       pt.addTranscodingHint(PrintTranscoder.KEY_AOI, aoi);

        TranscoderInput input = new TranscoderInput(document);

 

        pt.addTranscodingHint(pt.KEY_SHOW_PAGE_DIALOG,Boolean.TRUE);

        pt.addTranscodingHint(pt.KEY_SHOW_PRINTER_DIALOG,Boolean.TRUE);

        pt.transcode(input, null);

         

        try {pt.print();

        }

        catch (Exception ex)

        {

                  }

        }

      }.start();

}

 

My SVG example looks like this: 

 

<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"

"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">

<svg viewBox="0 0 400 400" >

            <g id="relief" visibility="visible">

                        <rect x="10" y="10" width="390" height="390"
fill="none" stroke="black" stroke-width="2"/>

                        <circle style="fill:none;stroke:black;" cx="200"
cy="200" r="100"/>

            </g>

            <g id="c" visibility="hidden">

                        <text x="200" y="200" style="font-family:
sans-serif; font-size: 14pt;

stroke: none; fill: black;">Center</text>

            </g>

            <text x="50" y="50" style="font-family: sans-serif; font-size:
14pt;

stroke: none; fill: black;">UL</text>

            <text x="50" y="350" style="font-family: sans-serif; font-size:
14pt;

stroke: none; fill: black;">BL</text>

            <text x="350" y="50" style="font-family: sans-serif; font-size:
14pt;

stroke: none; fill: black;">UR</text>

            <text x="350" y="350" style="font-family: sans-serif; font-size:
14pt;

stroke: none; fill: black;">BR</text>

            <line x1="190" y1="10" x2="190" y2="190" stroke="black"
stroke-width="2"/>

            <line x1="10" y1="190" x2="190" y2="190" stroke="black"
stroke-width="2"/>

</svg>

 

 

When I set: Rectangle aoi = new Rectangle(0,0,200,200); the area is smaller
then one I choose. 

When I set: Rectangle aoi = new Rectangle(200,200,200,200); nothing is being
printed.

 

Please give me any suggestion what I'm doing wrong. 

Thanks Bartek

 


Mime
View raw message