Salvador Fandiño García


Win32::EnumPrinters - Enumerate printers in Windows.


  use Win32::EnumPrinters qw(EnumPrinters);

  my @printers = EnumPrinters();


This module wraps Win32 EnumPrinters and some related functions.

Output C data structures are converted to Perl hashes. The names used for their slots are as in C but with any type declaration or structure name prefixes (i.e p for pointer, dw for DWORD, dm for DEVMODE, etc.) removed.


Any constant accepted by the supported functions in input parameters or included in output data can be imported by the module. For instance:

  use Win32::EnumPrinters qw(PRINTER_ATTRIBUTE_RAW_ONLY);

The constants have both an integer and a string value (in a similar fashion to $!). The string value is the C constant name lower-cased and with any common prefix removed. For instance, PRINTER_ATTRIBUTE_QUEUED is both queued and 1.

Enumeration values returned from the supported functions follow the same rule.

The following tags can also be used at import time to pick sets of constants:

    attribute => PRINTER_ATTRIBUTE_*
    dmbin => DMBIN_*
    dmcollate => DMCOLLATE_*
    dmcolor => DMCOLOR_*
    dmdfo => DMDFO_*
    dmdisplayflags => DM_*
    dmdither => DMDITHER_*
    dmdo => DMDO_*
    dmdup => DMDUP_*
    dmfield => DM_*
    dmicm => DMICM_*
    dmicmethod => DMICMMETHOD_*
    dmmedia => DMMEDIA_*
    dmnup => DMNUP_*
    dmpaper => DMPAPER_*
    dmres => DMRES_*
    dmtt => DMTT_*
    enum => PRINTER_ENUM_*
    formflag => FORM_*
    status => PRINTER_STATUS_*
    stringtype => STRING_*


The following functions can be imported from the module:

@printers = EnumPrinters($flags, $name, $level)

See EnumPrinters.

$name = GetDefaultPrinter()

See GetDefaultPrinter.

@forms = EnumForms($printer_name, $level)

See EnumForms.


Win32::Printer and Win32::Printer::Enum provide similar functionality, but they are not thin wrappers around the C/C++ functions.


Salvador Fandiño, <>


Copyright (C) 2017 by Qindel Formación y Servicios SL

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.