*/
    private void savePrinterProperties(PrintHelper printHelper) {
        PrintRequestAttributeSet printRequestAttributeSet =
                printHelper.getPrintRequestAttributeSet();

        Object printAttributeSet = printRequestAttributeSet.get(Media.class);

        if (propertiesManager != null &&
                printAttributeSet instanceof MediaSizeName) {
            MediaSizeName paper = (MediaSizeName) printAttributeSet;
            MediaSize mediaSize = MediaSize.getMediaSizeForName(paper);
            // write out the new page size property values.
            int printMediaUnit = MediaSize.MM;
            propertiesManager.set(
                    PropertiesManager.PROPERTY_PRINT_MEDIA_SIZE_UNIT,
                    String.valueOf(printMediaUnit));
            double printMediaWidth = mediaSize.getX(printMediaUnit);
            propertiesManager.set(
                    PropertiesManager.PROPERTY_PRINT_MEDIA_SIZE_WIDTH,
                    String.valueOf(printMediaWidth));
            double printMediaHeight = mediaSize.getY(printMediaUnit);
            propertiesManager.set(
                    PropertiesManager.PROPERTY_PRINT_MEDIA_SIZE_HEIGHT,
                    String.valueOf(printMediaHeight));
        }
    }