Home arrow static arrow Java Programming [Archive] - printer problem
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - printer problem
This topic has 1 reply on 1 page.

Posts:106
Registered: 20.04.04
printer problem  
Jul 21, 2004 2:57 AM



 
i try to print multiple pages but I can't get the first page. in fact it prints the 2nd page ( of two ) two times.
i draw all my text + graphics in a canvas in another class (parent) wich also calculates the number of pages to print. this number is correct. what do I wrong?

thanks a lot.

public int print( Graphics g, PageFormat pageFormat, int pageIndex ) throws PrinterException {

Graphics2D g2d = ( Graphics2D )g;

g2d = parent.getScreenToPrint( g2d );

int numOfPagesToPrint = parent.getNumOfPagesToPrint();
int numOfVPixel = 600;
int numOfHPixel = 300;

g2d.translate( (double)0, (double)( newStartPosV * -1 + numOfVPixel) );
g2d.setClip( 0, pageIndex * numOfVPixel, numOfHPixel, numOfVPixel );

if( pageIndex >= numOfPagesToPrint )
return NO_SUCH_PAGE;
else
return PAGE_EXISTS;
}

 

Posts:1,695
Registered: 1/13/04
Re: printer problem  
Jul 21, 2004 5:18 AM (reply 1 of 1)



 
Could you post the getScreenToPrint() code ?
The error should be located in it, I think.
 
This topic has 1 reply on 1 page.