Search in sources :

Example 1 with PrintPageAdapter

use of com.igormaznitsa.nbmindmap.nb.print.PrintPageAdapter in project netbeans-mmd-plugin by raydac.

the class MMDGraphEditor method getPages.

@Override
public PrintPage[][] getPages(final int paperWidthInPixels, final int paperHeightInPixels, final double pageZoomFactor) {
    final MMDPrintOptions printOptions = new MMDPrintOptions();
    if (pageZoomFactor < 0.1d) {
        printOptions.setScaleType(MMDPrintOptions.ScaleType.FIT_TO_SINGLE_PAGE);
    } else if (pageZoomFactor > 20.0d) {
        printOptions.setScaleType(MMDPrintOptions.ScaleType.ZOOM);
        printOptions.setScale(1.0d);
    } else {
        printOptions.setScaleType(MMDPrintOptions.ScaleType.ZOOM);
        printOptions.setScale(pageZoomFactor);
    }
    final com.igormaznitsa.mindmap.print.PrintPage[][] pages = new MMDPrint(this.mindMapPanel, paperWidthInPixels, paperHeightInPixels, printOptions).getPages();
    final PrintPage[][] result = new PrintPage[pages.length][];
    for (int i = 0; i < pages.length; i++) {
        result[i] = new PrintPage[pages[i].length];
        for (int p = 0; p < pages[i].length; p++) {
            result[i][p] = new PrintPageAdapter(pages[i][p]);
        }
    }
    return result;
}
Also used : PrintPage(org.netbeans.spi.print.PrintPage) MMDPrintOptions(com.igormaznitsa.mindmap.print.MMDPrintOptions) MMDPrint(com.igormaznitsa.mindmap.print.MMDPrint) PrintPageAdapter(com.igormaznitsa.nbmindmap.nb.print.PrintPageAdapter) MMDPrint(com.igormaznitsa.mindmap.print.MMDPrint)

Aggregations

MMDPrint (com.igormaznitsa.mindmap.print.MMDPrint)1 MMDPrintOptions (com.igormaznitsa.mindmap.print.MMDPrintOptions)1 PrintPageAdapter (com.igormaznitsa.nbmindmap.nb.print.PrintPageAdapter)1 PrintPage (org.netbeans.spi.print.PrintPage)1