You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Sudhakar S <ye...@hotmail.com> on 2006/05/16 08:16:20 UTC

Multi page print support

Hi All,

Has Multi page print support implemented? If implemented, please provide
from where i can get more information about it. 

Thanks,
Sudhakar
--
View this message in context: http://www.nabble.com/Multi-page-print-support-t1625300.html#a4403853
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by th...@kodak.com.
Hi Sudhakar,

Sudhakar S <ye...@hotmail.com> wrote on 05/30/2006 01:55:32 AM:

> > You also might clone the svg document, then set the width / height of 
the
> > cloned document to be > size you want. 
> 
> If i try to get the getCurrentScale() from the cloned document. it 
doesn't
> return the current scale value. it throws following exception in 
following
> line.
> 
> AffineTransform scrnTrans = getSVGContext().getScreenTransform();

[...]

> Can you please explain why svgContext context value is null? and is 
there
> anyother way to get the currentscale value in SVGAbstractTranscoder?

   When you clone the document the connection with the screen is broken.
I suggest you figure out how large you want the document to be printed
before you call the transcoder.  Then you can use the KEY_WIDTH, 
KEY_HEIGHT to tell the transcoder how large to print the document.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by Sudhakar S <ye...@hotmail.com>.
Hi Tonny Kohar,

> You also might clone the svg document, then set the width / height of the
> cloned document to be > size you want. 

If i try to get the getCurrentScale() from the cloned document. it doesn't
return the current scale value. it throws following exception in following
line.

AffineTransform scrnTrans = getSVGContext().getScreenTransform();

java.lang.NullPointerException
at
org.apache.batik.dom.svg.SVGOMSVGElement.getCurrentScale(SVGOMSVGElement.java:222)
at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:239)

Can you please explain why svgContext context value is null? and is there
anyother way to get the currentscale value in SVGAbstractTranscoder?

Thanks,
Sudhakar





--
View this message in context: http://www.nabble.com/Multi+page+print+support-t1625300.html#a4621494
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,
On Tue, 2006-05-23 at 03:57 -0700, Sudhakar S wrote:
> > How are you communicating the scale factor from the "customized viewer" 
> > to the print transcoder?  Isn't it just a matter of multiplying the root 
> > SVG element's width/height by this scale factor? 
> 
> Actually i dont know how to communicate scale factor from "customized
> viewer" 
> to the print transcoder? Multiplying "root.getCurrentScale()" with SVG
> element's width/height is enough to find the scaled width and height?

There are several options on the print transcoder that you might be
interested like width, height, max width, max height, area of interest
(AOI) that you could play around to see the effect / differences. 

You also might clone the svg document, then set the width / height of
the cloned document to be size you want.

Regards
Tonny Kohar

-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by Sudhakar S <ye...@hotmail.com>.
Hi Thomas,

> How are you communicating the scale factor from the "customized viewer" 
> to the print transcoder?  Isn't it just a matter of multiplying the root 
> SVG element's width/height by this scale factor? 

Actually i dont know how to communicate scale factor from "customized
viewer" 
to the print transcoder? Multiplying "root.getCurrentScale()" with SVG
element's width/height is enough to find the scaled width and height?

Thanks,
Sudhakar
--
View this message in context: http://www.nabble.com/Multi+page+print+support-t1625300.html#a4520934
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by th...@kodak.com.
Hi Sudhakar,

Sudhakar S <ye...@hotmail.com> wrote on 05/23/2006 06:25:33 AM:

> >  Who is zooming in and out, and how? 
> >  This is the print transcoder, isn't it? 
> 
> After opened the SVG document in customized viewer, i am doing
> zoomin/zoomout operations. then if i tried to print the scaled document 
with
> rootmost SVG element's height and width. it's not printing the entire 
scaled
> document. because it always returns rootmost SVG element's  width and
> height. it is not same as scaled document's height and width. so is 
there
> any way to find scaled document's width and height in print transcoder??

   How are you communicating the scale factor from the "customized viewer"
to the print transcoder?  Isn't it just a matter of multiplying the root
SVG element's width/height by this scale factor?


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by Sudhakar S <ye...@hotmail.com>.
Hi Thomas,

>  Who is zooming in and out, and how? 
>  This is the print transcoder, isn't it? 

After opened the SVG document in customized viewer, i am doing
zoomin/zoomout operations. then if i tried to print the scaled document with
rootmost SVG element's height and width. it's not printing the entire scaled
document. because it always returns rootmost SVG element's  width and
height. it is not same as scaled document's height and width. so is there
any way to find scaled document's width and height in print transcoder??

Thanks,
Sudhakar

--
View this message in context: http://www.nabble.com/Multi+page+print+support-t1625300.html#a4520583
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by th...@kodak.com.
Hi Sudhakar,

Sudhakar S <ye...@hotmail.com> wrote on 05/23/2006 02:31:43 AM:

> > The width and height of the document is available from: 
> > Dimension2D BridgeContext.getDocumentSize() 
> > This is the 'size in pixels' of the rootmost SVG element, if it 
> > has width/height attributes, otherwise it is whatever is returned 
> > by batik.bridge.UserAgent.getViewportSize(). 
> 
> It is always returns height and width of the rootmost SVG element. But 
while
> zoomin/zoomout, it is not returning the exact scaled width and height
> values. Is there anyway to find scaled transfom's width and height?

   Who is zooming in and out, and how? 
   This is the print transcoder, isn't it?

> Earlier i used following code to find the scaled width and height using
> SVGCanvas. Is there anyother way to find it without SVGCanvas??

   I'm sure you can figure it out but since I don't know how you
zooming it's hard to provide help.  The basic idea should be the
same, some 'known' rectangle is being mapped to the device space
by an affine.

> GraphicsNode node = svgCanvas.getGraphicsNode();
> Rectangle2D viewRect = (Rectangle2D)node.getBounds().clone();
> AffineTransform vCoordi = _svgCanvas.getViewBoxTransform();
> final Rectangle docSize = vCoordi.createTransformedShape(new 
Rectangle(0, 0,
> (int)viewRect.getWidth(),
>                             (int)viewRect.getHeight())).getBounds();


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by Sudhakar S <ye...@hotmail.com>.
Hi Thomas,

> The width and height of the document is available from: 
> Dimension2D BridgeContext.getDocumentSize() 
> This is the 'size in pixels' of the rootmost SVG element, if it 
> has width/height attributes, otherwise it is whatever is returned 
> by batik.bridge.UserAgent.getViewportSize(). 

It is always returns height and width of the rootmost SVG element. But while
zoomin/zoomout, it is not returning the exact scaled width and height
values. Is there anyway to find scaled transfom's width and height?


Earlier i used following code to find the scaled width and height using
SVGCanvas. Is there anyother way to find it without SVGCanvas??

GraphicsNode node = svgCanvas.getGraphicsNode();
Rectangle2D viewRect = (Rectangle2D)node.getBounds().clone();
AffineTransform vCoordi = _svgCanvas.getViewBoxTransform();
final Rectangle docSize = vCoordi.createTransformedShape(new Rectangle(0, 0,
(int)viewRect.getWidth(),
                            (int)viewRect.getHeight())).getBounds();



Thanks,
Sudhakar
--
View this message in context: http://www.nabble.com/Multi+page+print+support-t1625300.html#a4517950
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by th...@kodak.com.
Hi Sudhakar,

Sudhakar S <ye...@hotmail.com> wrote on 05/22/2006 09:34:17 AM:

> > If by Multi-page print support you mean automatic tiling of the 
document 
> > across multiple pages (so if you tape them together they form 
> > the 'oversized' page) then no. 
> 
> I tried to add ?automatic tiling of the document across multiple pages?
> feature in my application. [...] I couldn?t find the document?s width 
and
> height(svgImageWidth, svgImageHeight). I needs know width and height 
when
> user scaled/non scaled the document. So can you please explain how to 
find
> the width and height of the document in scaled/non scaled conditions.

   The width and height of the document is available from:
        Dimension2D BridgeContext.getDocumentSize()

   This is the 'size in pixels' of the rootmost SVG element, if it
has width/height attributes, otherwise it is whatever is returned
by batik.bridge.UserAgent.getViewportSize().


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by Sudhakar S <ye...@hotmail.com>.
Hi Thomas,

> If by Multi-page print support you mean automatic tiling of the document 
> across multiple pages (so if you tape them together they form 
> the 'oversized' page) then no.  

I tried to add “automatic tiling of the document across multiple pages”
feature in my application. To achieve it I have added following variables in
SVGAbstractTranscoder.

protected int curIndex = -1;
protected int numPagesInRow = -1;
protected int numPagesInCol = -1;
protected int totalPages = -1;

public static final TranscodingHints.Key KEY_MULTI_PAGE
            = new BooleanKey();

In my PrintTranscoder’s print(Graphics, PageFormat, int) method, I have
added the following code to find the total number of pages which is used to
find the X and Y values for multiple pages. 

if (totalPages == -1) {
numPagesInRow = (int)Math.ceil(svgImageWidth/
pageFormat.getImageableWidth());
numPagesInCol = (int)Math.ceil(svgImageHeight /
pageFormat.getImageableHeight());
totalPages = numPagesInRow * numPagesInCol;
}

if (pageIndex >= _totalPages) {
return Printable.NO_SUCH_PAGE;
}


I used KEY_AOI along with KEY_MULTI_PAGE to pass the Pageformat’s width and
Height. In SVGAbstractTranscoder’s transcode(Document,  String,
TranscoderOutput), I have checked the for KEY_MULTI_PAGE, if it is multipage
key, I found the originX and originY based on the current index value. 


if (hints.containsKey(KEY_MULTI_PAGE)) {
   Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI);

   double originX = ((curIndex +1) % _numPagesInRow) * aoi.getWidth();;
   double originY = ((curIndex +1) / _numPagesInRow) * aoi.getWidth();;


   double sx = svgImageWidth / aoi.getWidth();
   double sy = svgImageHeight / aoi.getHeight();
   double scale = Math.min(sx, sy);
   Px.scale(scale, scale);

   double tx = - originX + (width / scale - aoi.getWidth()) / 2;
   double ty = - originY + (height / scale - aoi.getHeight()) / 2;
   Px.translate(tx, ty);
   curAOI = aoi;
} else if (hints.containsKey(KEY_AOI)) {
.
.


But in both the places I couldn’t find the document’s width and
height(svgImageWidth, svgImageHeight). I needs know width and height when
user scaled/non scaled the document. So can you please explain how to find
the width and height of the document in scaled/non scaled conditions.

Thanks,
Sudhakar
--
View this message in context: http://www.nabble.com/Multi+page+print+support-t1625300.html#a4505455
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Multi page print support

Posted by th...@kodak.com.
Hi Sudhakar,

Sudhakar S <ye...@hotmail.com> wrote on 05/16/2006 02:16:20 AM:

> Has Multi page print support implemented? If implemented, please provide
> from where i can get more information about it. 

   If by Multi-page print support you mean automatic tiling of the
document across multiple pages (so if you tape them together
they form the 'oversized' page) then no.  Likewise if you
mean the 'page' and 'pageSet' elements that were proposed for
SVG print then no.  But if you have multiple SVG documents you
want to print together then this is supported by the PrintTranscoder
by calling 'transcode' multiple times each with a separate document,
before calling 'print'.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org