*/
    private void initialisePrinting(final boolean withDialog) {
        boolean canPrint = havePermissionToPrint();
        if (!canPrint) {
            reenablePrintUI();
            return;
        }
        // create a new print helper, one-to-one with document, make sure that
        // previous printer properties are preserved. default values listed
        // below are for NA_letter in millimeters.
        PrintHelper printHelper = viewModel.getPrintHelper();
        if (printHelper == null) {
            MediaSizeName mediaSizeName = loadDefaultPrinterProperties();
            // create the new print help
            printHelper = new PrintHelper(documentViewController, getPageTree(),
                    mediaSizeName,
                    PrintQuality.NORMAL);
        } else {
            printHelper = new PrintHelper(documentViewController, getPageTree(),
                    printHelper.getDocAttributeSet(),
                    printHelper.getPrintRequestAttributeSet());
        }
        viewModel.setPrintHelper(printHelper);

        // set the printer to show a print dialog
        canPrint = printHelper.setupPrintService(
                0,
                document.getNumberOfPages() - 1,
                1,           // default number of copies.
                viewModel.isShrinkToPrintableArea(),        // shrink to printable area
                withDialog  // show print dialogl
        );
        // save new printer attributes to properties
        savePrinterProperties(printHelper);
        // if user cancelled the print job from the dialog, don't start printing
        // in the background.
        if (!canPrint) {
            reenablePrintUI();
            return;
        }
        startBackgroundPrinting(printHelper);
    }