Solved! Go to Solution.
Whats the screen resolution you are working on?
Just for a quick test try DPI 150, then 200 and 300 and see what happens !!!
Hey, I followed this http://resources.arcgis.com/en/help/runtime-java/concepts/index.html#/Printing/01qv00000084000000/ to set up a print button on my application. The only problem I am having is making the map fit on one page. any idea how do achieve this?
I am not very clear on what the exact problem is. Have you set up the Paper size and Orientation? How are you setting that?
Paper paper = new Paper();
// ...set up the paper options...
PrinterJob printJob1 = PrinterJob.getPrinterJob();
PageFormat pageFormat = new PageFormat();
if (printJob1.printDialog()) {
try {printJob1.print();}
catch (PrinterException exc) {
System.out.println(exc);
}
}
//set up page format [DEFAULT] options and pass the paper settings through
pageFormat.setPaper(paper);
pageFormat.setOrientation(Integer.valueOf(PageFormat.LANDSCAPE));
// set page format for the map to print
map.setPageFormat(pageFormat);
printJob1.setPageable(map);
try {
// send job to printer!
printJob1.print();
} catch (PrinterException e) {
// handle the exception
}
You can use the DPI option while printing to adjust printing according to the paper size
int DPI = 96; // change DPI accordingly
Paper paper = new Paper();
MediaSize size = sizeMap.get(sizeList.getSelectedItem());
double width = (size.getX(Size2DSyntax.INCH))*DPI;
double height = (size.getY(Size2DSyntax.INCH))*DPI;
paper.setSize(width, height);
paper.setImageableArea(MARGIN, MARGIN, width - (2*MARGIN), height - (2*MARGIN));
I hope this helps
Whats the screen resolution you are working on?
Just for a quick test try DPI 150, then 200 and 300 and see what happens !!!