permaculture playing cards*
The moose likes Java in General and the fly likes Java printing problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java printing problem" Watch "Java printing problem" New topic
Author

Java printing problem

Marjan Stojnev
Greenhorn

Joined: Mar 03, 2009
Posts: 16
I am writing a simple program which will print data on specific location on pre-printed forms.
Something like this but in PORTRAIT mode:


I measure distance from bottom-left (or from bottom-right border) of page(in PORTRAIT mode) and
I expect that it will be same on each printer, but some printers move printing without reason...


When I try my program on my printer(Lexmark Z715), it worked correctly, but when I try it on HP LJ1020
and HP Deskjet F2280, locations for printing are misplaced.

This is picture with correctly placement(scroll it down)
(Grid is shown just for measurement...)
http://ictportal.info/b0ss/www/temp/goodPlace.jpg

This is what I get on HP-s:
(Grid is shown just for measurement...)
http://ictportal.info/b0ss/www/temp/wrongPlace.JPG


Can someone tell me how to know where exactly on page will be printed something in Java?

Part of program which print:

Moojid Hamid
Ranch Hand

Joined: Mar 07, 2009
Posts: 120
Just a guess: have you tried to set the prit area in the print mehod? try to set pf.getPaper().setImageableArea() where pf is your PageFormat object.
Marjan Stojnev
Greenhorn

Joined: Mar 03, 2009
Posts: 16
Moojid Hamid wrote:Just a guess: have you tried to set the prit area in the print mehod? try to set pf.getPaper().setImageableArea() where pf is your PageFormat object.


Thanks!
It works! I try It on my and on printer and on one HP and it works. I find that with g2d.translate(pf.getImageableX(), pf.getImageableY()); it does'nt work.
Interesting now is that I have big unprinted location on paper where is margin, but placement of image is correct. Can I manage it from Java - to say to printer to print maximum square of paper it can?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java printing problem
 
Similar Threads
Problem with setting attributes to printDialog window... Please advise...
Neef Help with Printing
Printing with Java
Printing in Unix
Collating