sun.print.Win32PrintService Java Examples

The following examples show how to use sun.print.Win32PrintService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #2
Source File: WPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = Win32PrintServiceLookup.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #3
Source File: WPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #4
Source File: WPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #5
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #6
Source File: WPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #7
Source File: WPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #8
Source File: WPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #9
Source File: WPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #10
Source File: WPrinterJob.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #11
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #12
Source File: WPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #13
Source File: WPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #14
Source File: WPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addPaperSize(PrintRequestAttributeSet aset,
                          int dmIndex, int width, int length) {

    if (aset == null) {
        return;
    }
    MediaSizeName msn =
       ((Win32PrintService)myService).findWin32Media(dmIndex);
    if (msn == null) {
        msn = ((Win32PrintService)myService).
            findMatchingMediaSizeNameMM((float)width, (float)length);
    }

    if (msn != null) {
        aset.add(msn);
    }
}
 
Example #15
Source File: WPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = Win32PrintServiceLookup.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #16
Source File: WPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void setWin32MediaAttrib(Attribute attr) {
    if (!(attr instanceof MediaSizeName)) {
        return;
    }
    MediaSizeName msn = (MediaSizeName)attr;
    mAttMediaSizeName = ((Win32PrintService)myService).findPaperID(msn);
}
 
Example #17
Source File: WPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = Win32PrintServiceLookup.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #18
Source File: WPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = PrintServiceLookupProvider.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #19
Source File: WPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Associate this PrinterJob with a new PrintService.
 *
 * Throws <code>PrinterException</code> if the specified service
 * cannot support the <code>Pageable</code> and
 * </code>Printable</code> interfaces necessary to support 2D printing.
 * @param a print service which supports 2D printing.
 *
 * @throws PrinterException if the specified service does not support
 * 2D printing.
 */
@Override
public void setPrintService(PrintService service)
    throws PrinterException {
    super.setPrintService(service);
    if (!(service instanceof Win32PrintService)) {
        return;
    }
    driverDoesMultipleCopies = false;
    driverDoesCollation = false;
    setNativePrintServiceIfNeeded(service.getName());
}
 
Example #20
Source File: WPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void setWin32MediaAttrib(Attribute attr) {
    if (!(attr instanceof MediaSizeName)) {
        return;
    }
    MediaSizeName msn = (MediaSizeName)attr;
    mAttMediaSizeName = ((Win32PrintService)myService).findPaperID(msn);
}
 
Example #21
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void setWin32MediaAttrib(Attribute attr) {
    if (!(attr instanceof MediaSizeName)) {
        return;
    }
    MediaSizeName msn = (MediaSizeName)attr;
    mAttMediaSizeName = ((Win32PrintService)myService).findPaperID(msn);
}
 
Example #22
Source File: WPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setWin32MediaAttrib(Attribute attr) {
    if (!(attr instanceof MediaSizeName)) {
        return;
    }
    MediaSizeName msn = (MediaSizeName)attr;
    mAttMediaSizeName = ((Win32PrintService)myService).findPaperID(msn);
}
 
Example #23
Source File: WPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Associate this PrinterJob with a new PrintService.
 *
 * Throws <code>PrinterException</code> if the specified service
 * cannot support the <code>Pageable</code> and
 * </code>Printable</code> interfaces necessary to support 2D printing.
 * @param a print service which supports 2D printing.
 *
 * @throws PrinterException if the specified service does not support
 * 2D printing.
 */
@Override
public void setPrintService(PrintService service)
    throws PrinterException {
    super.setPrintService(service);
    if (!(service instanceof Win32PrintService)) {
        return;
    }
    driverDoesMultipleCopies = false;
    driverDoesCollation = false;
    setNativePrintServiceIfNeeded(service.getName());
}
 
Example #24
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void setWin32MediaAttrib(Attribute attr) {
    if (!(attr instanceof MediaSizeName)) {
        return;
    }
    MediaSizeName msn = (MediaSizeName)attr;
    mAttMediaSizeName = ((Win32PrintService)myService).findPaperID(msn);
}
 
Example #25
Source File: WPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = Win32PrintServiceLookup.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #26
Source File: WPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void setWin32MediaAttrib(Attribute attr) {
    if (!(attr instanceof MediaSizeName)) {
        return;
    }
    MediaSizeName msn = (MediaSizeName)attr;
    mAttMediaSizeName = ((Win32PrintService)myService).findPaperID(msn);
}
 
Example #27
Source File: WPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = PrintServiceLookupProvider.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #28
Source File: WPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Associate this PrinterJob with a new PrintService.
 *
 * Throws {@code PrinterException} if the specified service
 * cannot support the {@code Pageable} and
 * </code>Printable</code> interfaces necessary to support 2D printing.
 * @param service print service which supports 2D printing.
 *
 * @throws PrinterException if the specified service does not support
 * 2D printing.
 */
@Override
public void setPrintService(PrintService service)
    throws PrinterException {
    super.setPrintService(service);
    if (!(service instanceof Win32PrintService)) {
        return;
    }
    driverDoesMultipleCopies = false;
    driverDoesCollation = false;
    setNativePrintServiceIfNeeded(service.getName());
}
 
Example #29
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PrintService getPrintService() {
    if (myService == null) {
        String printerName = getNativePrintService();

        if (printerName != null) {
            myService = Win32PrintServiceLookup.getWin32PrintLUS().
                getPrintServiceByName(printerName);
            // no need to call setNativePrintService as this name is
            // currently set in native
            if (myService != null) {
                return myService;
            }
        }

        myService = PrintServiceLookup.lookupDefaultPrintService();
        if (myService instanceof Win32PrintService) {
            try {
                setNativePrintServiceIfNeeded(myService.getName());
            } catch (Exception e) {
                myService = null;
            }
        }

      }
      return myService;
}
 
Example #30
Source File: WPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Associate this PrinterJob with a new PrintService.
 *
 * Throws <code>PrinterException</code> if the specified service
 * cannot support the <code>Pageable</code> and
 * </code>Printable</code> interfaces necessary to support 2D printing.
 * @param a print service which supports 2D printing.
 *
 * @throws PrinterException if the specified service does not support
 * 2D printing.
 */
@Override
public void setPrintService(PrintService service)
    throws PrinterException {
    super.setPrintService(service);
    if (!(service instanceof Win32PrintService)) {
        return;
    }
    driverDoesMultipleCopies = false;
    driverDoesCollation = false;
    setNativePrintServiceIfNeeded(service.getName());
}