편집

다음을 통해 공유


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.

Screenshot of the Universal Print Azure portal home page

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.

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:

  1. Create a print job and store the resulting document ID.
  2. Create an uploadSession for the document.
  3. Upload bytes to the created upload session.
  4. Start the print job.

Manage printers

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.

Seamlessly replace or update printer hardware

Printers aren't 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 printer reference.

Enable pull printing

The Microsoft Graph Universal Print API enables your application to support pull printing. To set up pull printing, you 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:

  1. Create a printTaskDefinition using application permissions. This abstract task definition is 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).

  2. Register one or more virtual printers using an administrator authentication token and a null physicalDeviceId. A "virtual printer" is just a printer object in Universal Print without a physical device attached. Usually, users print to virtual printers and later pick up their print jobs at a physical print device. See step 6.

  3. Update the attributes of your virtual printer by using application permissions and an application/ipp media type (see examples).

  4. 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.

  5. When a print job is submitted to the virtual printer, it is paused due to the printTaskTrigger. A printTask with processing state will be created based on the associated printTaskDefinition.

  6. When the user swipes a badge at a physical printer device, the printer notifies 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.

  7. 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 processing state on the associated printer started by a trigger that this app created in step 4. The task will automatically be set to completed state after redirecting it.

API reference

Looking for the API reference for this service?

Provide feedback

We'd love to hear your feedback about the Universal Print APIs. Provide your suggestions on the Microsoft 365 Developer Platform ideas forum.