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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]