Universal Print cloud printing API overview
Universal Print is a modern print solution that organizations can use to manage their print infrastructure through cloud services from Microsoft.
Why use Universal Print?
Universal Print moves key Windows Server print functionality to the Microsoft 365 cloud, so organizations no longer need on-premises print servers and do not need to install printer drivers on devices. In addition, Universal Print adds key functionality like security groups for printer access, location-based printer discovery, and a rich administrator experience.
As organizations adopt Universal Print, organizations and independent software vendors (ISVs) can use the Universal Print API in Microsoft Graph to build and extend applications to support new scenarios.
Print documents from web and mobile applications
Moving print infrastructure to the cloud enables printing documents directly from web and mobile applications.
- Users can submit print jobs to printerShare.
- Printer admins can also submit print jobs to a printer, for doing preliminary testing before sharing the printer with the organization.
Follow these steps to submit print jobs to printerShare:
- Create a print job and store the resulting document ID.
- Create an uploadSession for the document.
- Upload bytes to the created upload session.
- Start the print job.
Keeping track of an organization's printers, printer configurations, and printer usage is a complex task. The Universal Print API enables integration in all three areas.
See who's using your printers and how much they're printing by using the reporting APIs:
Configure user permissions by modifying user and group membership on printers:
Seamlessly replace or update printer hardware
Printers are not visible to users until they are shared, providing administrators fine-grained control over which printer hardware is available at a given time.
Sharing a printer creates a printerShare resource that can be updated at any time to point to a different printer, making it easy to replace broken printer hardware or take printers offline for maintenance.
To use this in your application, use Update printerShare to update the printerShare's
Enable pull printing
The Microsoft Graph Universal Print API enables your application to support pull printing. To set up pull printing, you will register triggers that notify your application (via service-to-service communication) when certain print events happen, such as a print job being started.
These triggers enable your application to interrupt the print workflow to do things such as redirecting jobs to different printers and modifying the document payload.
Follow these steps to enable pull printing:
Create a printTaskDefinition using application permissions. This abstract task definition will be used to create task that will hold the job for your application. You need to define at least one task definition per tenant, which can be associated with any number of printers in the tenant using task triggers (see step 4).
Register one or more virtual printers using an administrator authentication token and a
nullphysicalDeviceId. A "virtual printer" is just a printer object in Universal Print without a physical device attached. Usually, users will print to virtual printers and later pick up their print jobs at a physical print device. See step 6.
Update the attributes of your virtual printer by using application permissions and an
application/ippmedia type (see examples).
Create a task trigger for your virtual printer using an administrator authentication token that will associate your task definition with virtual printer. The appId used to generate the access token should be the same appId that was used to create the task definition.
When the user swipes a badge at a physical printer device, the printer will notify your application. At that time, your application can fetch the jobs of the associated virtual printer and filter the list to jobs created by the current user.
When the user selects one or more jobs to print, your application can redirect the print job(s) to the physical printer and the job will start printing! The redirect call will only succeed if there is a printTask in
processingstate on the associated printer started by a trigger that this app created in step 4. The task will automatically be set to
completedstate after redirecting it.
Looking for the API reference for this service?
We'd love to hear your feedback about the Universal Print APIs. Provide your suggestions on the Microsoft 365 Developer Platform ideas forum.