1

I have a map viewer that was developed using the ArcGIS Runtime Java SDK. I am trying to make a print button and it works with one issue. I can't seem to figure out how to make it fit on one page.

 private void printMap() {
 Paper paper = new Paper();
 // ...set up the paper options...
 PrinterJob printJob1 = PrinterJob.getPrinterJob(); 
 PageFormat pageFormat = new PageFormat();
 HashPrintRequestAttributeSet set = new HashPrintRequestAttributeSet(); 
 if (printJob1.printDialog(set)) {
 try {printJob1.print(set);}
 catch (PrinterException exc) {
 // System.out.println(exc);
 }
 } 
 //set up page format [DEFAULT] options and pass the paper settings through
 pageFormat.setPaper(paper);
 // set page format for the map to print
 map.setPageFormat(pageFormat);
 printJob1.setPageable(map);
 try {
 // send job to printer!
 printJob1.print();
 // new PrintMe().print(YourJTextComponent);
 } catch (PrinterException e) {
 // handle the exception
 }
}

I'm using Eclipse Kepler SR1, resolution is 1920x1080. Any ideas or suggestions?

This is how it prints enter image description here

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Feb 10, 2014 at 16:42
0

1 Answer 1

1

got it. What I did was convert the map into a png and then printed it.

I used this as a reference to convert the map into a image.

answered Feb 10, 2014 at 19:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.