Hello there,

The application being developed allows user to open an image(jpeg) and cloud portion of the image(dotted lines marking the boundary). I am able to print the original full size image on a single page but the question is how do i print only the portion of the image bounded by the dotted lines or the cloud? Basically what I have done is to use drawImage function as follows in the print() block:

g2d.drawImage(componentToBePrinted.getImage(), componentToBePrinted2.getTopLeftX(), componentToBePrinted2.getTopLeftY() , 20 , 30,(ImageObserver) this);

componentToBePrinted is an instance of the Diagram class containing reference to the image.
componentToBePrinted2 is an instance of the cloud which contains the coordinates of the dotes.

For your info, the following is the working code to print the entire image:


Any hint how to solve it? Thanks