1 Replies - 232 Views - Last Post: 20 January 2013 - 08:21 PM Rate Topic: -----

#1 Crowz  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 68
  • Joined: 09-February 12

Printing images (on paper), something seems quite off. Lots of code.

Posted 20 January 2013 - 07:40 PM

Okay, so this is quite a big program but the idea is it draws grids on top of images and prints them out with proportional grids.

Here is the part of the grid that corresponds to printing. This is in the main class.
if(choose.equals("Print Picture")) {
		PrinterJob printJob = PrinterJob.getPrinterJob();
		Book book = new Book();
		book.append(new Picture(), printJob.defaultPage());
		printJob.setPageable(book);
		printJob.printDialog();
		try {
			printJob.print();
		} catch (Exception PrintException) {
			PrintException.printStackTrace();
		}
	}


And on another class
public class Picture implements Printable {
	public int print(Graphics g, PageFormat pageFormat, int page) throws PrinterException {
		g.translate((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY());
		g.drawImage(GridCreator.getmyImg(),0,0,null);
		return PAGE_EXISTS;
	}
}


So when I PRINT the image, it comes out huge on U.S. 8.5 x 11 paper. 1/3 of the image taking up the whole picture. The original image I used was 1280px by 930px.
When I take the same image file and put it in photoshop on U.S. paper document, it looks like this
http://i.imgur.com/DRFrYAf.png

What am I doing wrong?

Is This A Good Question/Topic? 0
  • +

Replies To: Printing images (on paper), something seems quite off. Lots of code.

#2 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 838
  • Posts: 2,573
  • Joined: 29-July 11

Re: Printing images (on paper), something seems quite off. Lots of code.

Posted 20 January 2013 - 08:21 PM

So, you want it to look like the photoshop image, right? And where is the original image. Post a link, please.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1