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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.