What printer (vendor & model) does the shelter have, and what printer
driver? What OS are you each using?
Contact the printer manufacture with this information and ask about
possible incompatibilities. There maybe other issues (bugs) or APIs
which you are unaware that could be affecting output format. You can
try talking to Oracle too but generally I've found them unresponsive to
small developers.
Could you post a sample of the printer code? Stefan raises a good point
that the issue could be in your code as well.
I don't have the printer manufacturer. It is a color ink jet printer.
The OS is Windows 7. The print code is below (with the AffineTransform
to make it work). It prints fine on my LaserJet under Windows 8.
Thanks,
knute...
public int print(Graphics g, PageFormat pf, int index) {
if (index == 0) {
System.out.printf("Width: %f\nHeight: %f\n" +
"ImageableWidth: %f\nImageableHeight: %f\n" +
"ImageableX: %f\nImageableY: %f\n",
pf.getWidth(),pf.getHeight(),pf.getImageableWidth(),
pf.getImageableHeight(),pf.getImageableX(),pf.getImageableY());
String orientation;
switch (pf.getOrientation()) {
case PageFormat.LANDSCAPE:
orientation = "Landscape";
break;
case PageFormat.PORTRAIT:
orientation = "Portrait";
break;
case PageFormat.REVERSE_LANDSCAPE:
orientation = "Reverse Landscape";
break;
default:
orientation = "default";
break;
}
System.out.printf("Orientation: %s\n",orientation);
render(g,pf);
return Printable.PAGE_EXISTS;
} else
return Printable.NO_SUCH_PAGE;
}
private void render(Graphics g2D, PageFormat pf) {
Graphics2D g = (Graphics2D)g2D;
BufferedImage image = photoPanel.getImage();
AffineTransform at = g.getTransform();
g.scale(0.5,1.0); // needed for SOTH' printer
g.setFont(new Font("Arial",Font.BOLD,64));
FontMetrics fm = g.getFontMetrics();
String str = lost.isSelected() ? "LOST" : "FOUND";
g.drawString(str,
((int)pf.getWidth()-fm.stringWidth(str))/2,100);
g.setFont(new Font("Arial",Font.PLAIN,18));
fm = g.getFontMetrics();
if (image != null) {
double ratio = (double)image.getWidth() / image.getHeight();
double factor;
if (ratio >= 1.7777779) // aspect ratio >= than 16x9
factor = 468.0 / image.getWidth();
else
factor = 263.0 / image.getHeight();
int w = (int)(image.getWidth() * factor);
int h = (int)(image.getHeight() * factor);
int x = ((int)pf.getWidth() - w) / 2;
g.drawImage(image,x,150,w,h,null);
} else {
str = "No Photo Available";
g.drawString(str,(int)(pf.getWidth()-fm.stringWidth(str))/2,280);
g.drawRect(72,150,468,263);
}
int y = 450;
if (name.getText().length() > 0) {
str = String.format("Name: %s",name.getText());
g.drawString(str,72,y);
y += (fm.getHeight() * 2);
}
String[] text = desc.getText().split("\n");
for (String t : text) {
g.drawString(t,72,y);
y += fm.getHeight();
}
y += fm.getHeight();
if (location.getText().length() > 0) {
str = String.format("Location: %s",location.getText());
g.drawString(str,72,y);
y += (fm.getHeight() * 2);
}
if (contact.getText().length() > 0) {
str = String.format("Contact: %s",contact.getText());
g.drawString(str,72,y);
}
g.setTransform(at);
}