Print API
The Print API enables document printing functionality in your POS UI extension. Use this API to trigger the native print dialog for your documents.
Supported document types:
-
HTML documents (
.html,.htm) - Best printing experience with full CSS styling, embedded images, and complex layouts. Use for receipts, invoices, and formatted reports. -
Text files (
.txt,.csv) - Plain text with basic content and tabular data support. Use for simple receipts and data exports. -
Image files (
.png,.jpg,.jpeg,.gif,.bmp,.webp) - Common web formats with format-specific optimizations. Use for logos, charts, QR codes, and barcodes. -
PDF files (
.pdf) - Behavior varies by platform: prints directly on iOS/desktop, but downloads to external viewer on Android. Use for complex documents and compliance requirements.
Anchor to Use casesUse cases
- Custom receipts: Print custom receipts or invoices with branded formatting.
- Labels: Generate and print shipping labels, return labels, or inventory documents.
- Reports: Create printed reports for sales analytics, inventory counts, or summaries.
- Customer communications: Print loyalty program info, promotional materials, or instructions.
Supported targets
- pos.
cart. line-item-details. action. menu-item. render - pos.
cart. line-item-details. action. render - pos.
customer-details. action. menu-item. render - pos.
customer-details. action. render - pos.
customer-details. block. render - pos.
draft-order-details. action. menu-item. render - pos.
draft-order-details. action. render - pos.
draft-order-details. block. render - pos.
exchange. post. action. menu-item. render - pos.
exchange. post. action. render - pos.
exchange. post. block. render - pos.
home. modal. render - pos.
home. tile. render - pos.
order-details. action. menu-item. render - pos.
order-details. action. render - pos.
order-details. block. render - pos.
product-details. action. menu-item. render - pos.
product-details. action. render - pos.
product-details. block. render - pos.
purchase. post. action. menu-item. render - pos.
purchase. post. action. render - pos.
purchase. post. block. render - pos.
register-details. action. menu-item. render - pos.
register-details. action. render - pos.
register-details. block. render - pos.
return. post. action. menu-item. render - pos.
return. post. action. render - pos.
return. post. block. render
Supported targets
- pos.
cart. line-item-details. action. menu-item. render - pos.
cart. line-item-details. action. render - pos.
customer-details. action. menu-item. render - pos.
customer-details. action. render - pos.
customer-details. block. render - pos.
draft-order-details. action. menu-item. render - pos.
draft-order-details. action. render - pos.
draft-order-details. block. render - pos.
exchange. post. action. menu-item. render - pos.
exchange. post. action. render - pos.
exchange. post. block. render - pos.
home. modal. render - pos.
home. tile. render - pos.
order-details. action. menu-item. render - pos.
order-details. action. render - pos.
order-details. block. render - pos.
product-details. action. menu-item. render - pos.
product-details. action. render - pos.
product-details. block. render - pos.
purchase. post. action. menu-item. render - pos.
purchase. post. action. render - pos.
purchase. post. block. render - pos.
register-details. action. menu-item. render - pos.
register-details. action. render - pos.
register-details. block. render - pos.
return. post. action. menu-item. render - pos.
return. post. action. render - pos.
return. post. block. render
Anchor to PropertiesProperties
The shopify global object provides methods for triggering document printing. Access the following properties on shopify to initiate print operations with HTML, text, image, and PDF document types.
- Anchor to printprintprint(src: string) => Promise<void>(src: string) => Promise<void>requiredrequired
Triggers a print dialog for the specified document source. The
print()method accepts either:• A relative path that will be appended to your app's
• A full URL to your app's backend that will be used to return the document to print
Returns a promise that resolves when content is ready and the native print dialog appears. Use for printing custom documents, receipts, labels, or reports.
Anchor to Best practicesBest practices
- Use appropriate document formats: Choose HTML for rich formatting and responsive design, text for simple content, images for graphics, and PDFs for complex documents while considering platform limitations.
- Handle printing errors gracefully: Implement proper error handling for print operations, including network failures, unsupported document types, or printer connectivity issues.
- Optimize documents for printing: Design your printable documents with appropriate sizing, margins, and formatting that work well with printers and standard paper sizes.
- Provide user feedback: Give users clear feedback about print operations, including loading states, success confirmations, and error messages when printing fails.
Anchor to LimitationsLimitations
PDF printing on Android devices requires downloading the file and using an external application, which may interrupt the user workflow.