winspool topic

Windows Print Spooler APIs

The Print Spooler API provides an interface to the print spooler for applications to manage printers and print jobs.

Functions

AbortPrinter(PRINTER_HANDLE hPrinter) bool winspool
Deletes a printers spool file if the printer is configured for spooling.
AddForm(PRINTER_HANDLE hPrinter, int level, Pointer<Uint8> pForm) bool winspool
Adds a form to the list of available forms that can be selected for the specified printer.
AddJob(PRINTER_HANDLE hPrinter, int level, Pointer<Uint8>? pData, int cbBuf, Pointer<Uint32> pcbNeeded) bool winspool
Adds a print job to the list of print jobs that can be scheduled by the print spooler.
AddPrinter(PCWSTR? pName, int level, Pointer<Uint8> pPrinter) Win32Result<PRINTER_HANDLE> winspool
Adds a printer to the list of supported printers for a specified server.
AddPrinterConnection(PCWSTR pName) bool winspool
Adds a connection to the specified printer for the current user.
AddPrinterConnection2(HWND? hWnd, PCWSTR pszName, int dwLevel, Pointer<NativeType> pConnectionInfo) bool winspool
Adds a connection to the specified printer for the current user and specifies connection details.
AdvancedDocumentProperties(HWND hWnd, PRINTER_HANDLE hPrinter, PCWSTR pDeviceName, Pointer<DEVMODE>? pDevModeOutput, Pointer<DEVMODE>? pDevModeInput) int winspool
Displays a printer-configuration dialog box for the specified printer, allowing the user to configure that printer.
ClosePrinter(PRINTER_HANDLE hPrinter) Win32Result<bool> winspool
Closes the specified printer object.
CloseSpoolFileHandle(PRINTER_HANDLE hPrinter, HANDLE hSpoolFile) bool winspool
Closes a handle to a spool file associated with the print job currently submitted by the application.
CommitSpoolData(PRINTER_HANDLE hPrinter, HANDLE hSpoolFile, int cbCommit) HANDLE winspool
Notifies the print spooler that a specified amount of data has been written to a specified spool file and is ready to be rendered.
ConfigurePort(PCWSTR? pName, HWND hWnd, PCWSTR pPortName) bool winspool
Displays the port-configuration dialog box for a port on the specified server.
ConnectToPrinterDlg(HWND hwnd, int flags) HANDLE winspool
Displays a dialog box that lets users browse and connect to printers on a network.
DeleteForm(PRINTER_HANDLE hPrinter, PCWSTR pFormName) bool winspool
Removes a form name from the list of supported forms.
DeletePrinter(PRINTER_HANDLE hPrinter) Win32Result<bool> winspool
Deletes the specified printer object.
DeletePrinterConnection(PCWSTR pName) bool winspool
Deletes a connection to a printer that was established by a call to AddPrinterConnection or ConnectToPrinterDlg.
DeletePrinterData(PRINTER_HANDLE hPrinter, PCWSTR pValueName) int winspool
Deletes specified configuration data for a printer.
DeletePrinterDataEx(PRINTER_HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName) int winspool
Deletes a specified value from the configuration data for a printer.
DeletePrinterKey(PRINTER_HANDLE hPrinter, PCWSTR pKeyName) int winspool
Deletes a specified key and all its subkeys for a specified printer.
DocumentProperties(HWND? hWnd, PRINTER_HANDLE hPrinter, PCWSTR pDeviceName, Pointer<DEVMODE>? pDevModeOutput, Pointer<DEVMODE>? pDevModeInput, int fMode) int winspool
Retrieves or modifies printer initialization information or displays a printer-configuration property sheet for the specified printer.
EndDocPrinter(PRINTER_HANDLE hPrinter) bool winspool
Ends a print job for the specified printer.
EndPagePrinter(PRINTER_HANDLE hPrinter) bool winspool
Notifies the print spooler that the application is at the end of a page in a print job.
EnumForms(PRINTER_HANDLE hPrinter, int level, Pointer<Uint8>? pForm, int cbBuf, Pointer<Uint32> pcbNeeded, Pointer<Uint32> pcReturned) bool winspool
Enumerates the forms supported by the specified printer.
EnumJobs(PRINTER_HANDLE hPrinter, int firstJob, int noJobs, int level, Pointer<Uint8>? pJob, int cbBuf, Pointer<Uint32> pcbNeeded, Pointer<Uint32> pcReturned) Win32Result<bool> winspool
Retrieves information about a specified set of print jobs for a specified printer.
EnumPrinterData(PRINTER_HANDLE hPrinter, int dwIndex, PWSTR pValueName, int cbValueName, Pointer<Uint32> pcbValueName, Pointer<Uint32>? pType, Pointer<Uint8>? pData, int cbData, Pointer<Uint32>? pcbData) int winspool
Enumerates configuration data for a specified printer.
EnumPrinterDataEx(PRINTER_HANDLE hPrinter, PCWSTR pKeyName, Pointer<Uint8>? pEnumValues, int cbEnumValues, Pointer<Uint32> pcbEnumValues, Pointer<Uint32> pnEnumValues) int winspool
Enumerates all value names and data for a specified printer and key.
EnumPrinterKey(PRINTER_HANDLE hPrinter, PCWSTR pKeyName, PWSTR? pSubkey, int cbSubkey, Pointer<Uint32> pcbSubkey) int winspool
Enumerates the subkeys of a specified key for a specified printer.
EnumPrinters(int flags, PCWSTR? name, int level, Pointer<Uint8>? pPrinterEnum, int cbBuf, Pointer<Uint32> pcbNeeded, Pointer<Uint32> pcReturned) Win32Result<bool> winspool
Enumerates available printers, print servers, domains, or print providers.
FindClosePrinterChangeNotification(FINDPRINTERCHANGENOTIFICATION_HANDLE hChange) bool winspool
Closes a change notification object created by calling the FindFirstPrinterChangeNotification function.
FindFirstPrinterChangeNotification(PRINTER_HANDLE hPrinter, int fdwFilter, int fdwOptions, Pointer<NativeType>? pPrinterNotifyOptions) FINDPRINTERCHANGENOTIFICATION_HANDLE winspool
Creates a change notification object and returns a handle to the object.
FindNextPrinterChangeNotification(FINDPRINTERCHANGENOTIFICATION_HANDLE hChange, Pointer<Uint32>? pdwChange, Pointer<Pointer<NativeType>>? ppPrinterNotifyInfo) bool winspool
Retrieves information about the most recent change notification for a change notification object associated with a printer or print server.
FlushPrinter(PRINTER_HANDLE hPrinter, Pointer<NativeType>? pBuf, int cbBuf, Pointer<Uint32> pcWritten, int cSleep) bool winspool
Sends a buffer to the printer in order to clear it from a transient state.
FreePrinterNotifyInfo(Pointer<PRINTER_NOTIFY_INFO> pPrinterNotifyInfo) bool winspool
Frees a system-allocated buffer created by the FindNextPrinterChangeNotification function.
GetDefaultPrinter(PWSTR? pszBuffer, Pointer<Uint32> pcchBuffer) bool winspool
Retrieves the printer name of the default printer for the current user on the local computer.
GetForm(PRINTER_HANDLE hPrinter, PCWSTR pFormName, int level, Pointer<Uint8>? pForm, int cbBuf, Pointer<Uint32> pcbNeeded) bool winspool
Retrieves information about a specified form.
GetJob(PRINTER_HANDLE hPrinter, int jobId, int level, Pointer<Uint8>? pJob, int cbBuf, Pointer<Uint32> pcbNeeded) bool winspool
Retrieves information about a specified print job.
GetPrinter(PRINTER_HANDLE hPrinter, int level, Pointer<Uint8>? pPrinter, int cbBuf, Pointer<Uint32> pcbNeeded) Win32Result<bool> winspool
Retrieves information about a specified printer.
GetPrinterData(PRINTER_HANDLE hPrinter, PCWSTR pValueName, Pointer<Uint32>? pType, Pointer<Uint8>? pData, int nSize, Pointer<Uint32> pcbNeeded) int winspool
Retrieves configuration data for the specified printer or print server.
GetPrinterDataEx(PRINTER_HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName, Pointer<Uint32>? pType, Pointer<Uint8>? pData, int nSize, Pointer<Uint32> pcbNeeded) int winspool
Retrieves configuration data for the specified printer or print server.
GetPrintExecutionData(Pointer<PRINT_EXECUTION_DATA> pData) bool winspool
The GetPrintExecutionData retrieves the current print context.
GetSpoolFileHandle(PRINTER_HANDLE hPrinter) Win32Result<HANDLE> winspool
Retrieves a handle for the spool file associated with the job currently submitted by the application.
IsValidDevmode(Pointer<DEVMODE>? pDevmode, int devmodeSize) bool winspool
Verifies that the contents of a DEVMODE structure are valid.
OpenPrinter(PCWSTR? pPrinterName, Pointer<Pointer<NativeType>> phPrinter, Pointer<PRINTER_DEFAULTS>? pDefault) Win32Result<bool> winspool
Retrieves a handle to the specified printer or print server or other types of handles in the print subsystem.
OpenPrinter2(PCWSTR? pPrinterName, Pointer<Pointer<NativeType>> phPrinter, Pointer<PRINTER_DEFAULTS>? pDefault, Pointer<PRINTER_OPTIONS>? pOptions) Win32Result<bool> winspool
Retrieves a handle to the specified printer, print server, or other types of handles in the print subsystem, while setting some of the printer options.
PrinterProperties(HWND hWnd, PRINTER_HANDLE hPrinter) bool winspool
Displays a printer-properties property sheet for the specified printer.
ReadPrinter(PRINTER_HANDLE hPrinter, Pointer<NativeType> pBuf, int cbBuf, Pointer<Uint32> pNoBytesRead) bool winspool
Retrieves data from the specified printer.
ReportJobProcessingProgress(HANDLE printerHandle, int jobId, EPrintXPSJobOperation jobOperation, EPrintXPSJobProgress jobProgress) → void winspool
Reports to the Print Spooler service whether an XPS print job is in the spooling or the rendering phase and what part of the processing is currently underway.
ResetPrinter(PRINTER_HANDLE hPrinter, Pointer<PRINTER_DEFAULTS>? pDefault) bool winspool
Specifies the data type and device mode values to be used for printing documents submitted by the StartDocPrinter function.
ScheduleJob(PRINTER_HANDLE hPrinter, int jobId) bool winspool
Requests that the print spooler schedule a specified print job for printing.
SetDefaultPrinter(PCWSTR? pszPrinter) bool winspool
Sets the printer name of the default printer for the current user on the local computer.
SetForm(PRINTER_HANDLE hPrinter, PCWSTR pFormName, int level, Pointer<Uint8> pForm) bool winspool
Sets the form information for the specified printer.
SetJob(PRINTER_HANDLE hPrinter, int jobId, int level, int command) bool winspool
Pauses, resumes, cancels, or restarts a print job on a specified printer.
SetPort(PCWSTR? pName, PCWSTR pPortName, int dwLevel, Pointer<Uint8> pPortInfo) Win32Result<bool> winspool
Sets the status associated with a printer port.
SetPrinter(PRINTER_HANDLE hPrinter, int level, Pointer<Uint8>? pPrinter, int command) Win32Result<bool> winspool
Sets the data for a specified printer or sets the state of the specified printer by pausing printing, resuming printing, or clearing all print jobs.
SetPrinterData(PRINTER_HANDLE hPrinter, PCWSTR pValueName, int type, Pointer<Uint8> pData, int cbData) int winspool
Sets the configuration data for a printer or print server.
SetPrinterDataEx(PRINTER_HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName, int type, Pointer<Uint8> pData, int cbData) int winspool
Sets the configuration data for a printer or print server.
StartDocPrinter(PRINTER_HANDLE hPrinter, int level, Pointer<DOC_INFO_1> pDocInfo) int winspool
Notifies the print spooler that a document is to be spooled for printing.
StartPagePrinter(PRINTER_HANDLE hPrinter) bool winspool
Notifies the spooler that a page is about to be printed on the specified printer.
WritePrinter(PRINTER_HANDLE hPrinter, Pointer<NativeType> pBuf, int cbBuf, Pointer<Uint32> pcWritten) bool winspool
Notifies the print spooler that data should be written to the specified printer.