PrintBase
  • Product
  • Pricing
  • Docs
  • Resources
PrintBase/Guides/Platform printing integrations

How to auto-print Magento packing slips

Print a Magento or Adobe Commerce packing slip from an observer on the server. No PrintBase Magento module is included.

For Adobe Commerce and Magento teams shipping from a warehouse printer

Overview

Magento's packing slip is a PDF the admin can download. Printing it when a shipment is saved is an observer on sales_order_shipment_save_after, running in PHP on your server. PrintBase does not ship a Magento module.

Render or reuse the shipment PDF, base64 it, and POST content_type pdf to the warehouse printer_code. Multi-source inventory means the printer_code should follow the source or the stock, not a single global code, unless you really have one bench.

Idempotency-Key magento-slip-{shipmentId} handles the observer running more than once. The API key goes in env.php or an environment variable, not in a storefront block.

Integration steps

  1. 01

    Observe shipment save

    Server-side observer only. A storefront plugin must not see the API key.

  2. 02

    Produce the PDF

    Use the shipment PDF you already generate for email or admin download.

  3. 03

    Choose printer_code by source

    Map MSI source or warehouse code to a printer_code from GET /v1/printers.

  4. 04

    POST pdf

    Standard base64 content, copies 1, Bearer token, idempotency key.

  5. 05

    Log the job on the shipment

    Comments or a custom column with the job id help when the bench says nothing printed.

PHP

<?php
// Magento shipment observer: packing-slip PDF
$payload = [
    'printer_code' => (int) getenv('PRINTER_CODE'),
    'content_type' => 'pdf',
    'content' => base64_encode($pdf),,
    'copies' => 1,
];
$ch = curl_init('https://api.printbase.cloud/v1/print-jobs');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('PRINTBASE_API_KEY'),
        'Content-Type: application/json',
        'Idempotency-Key: ' . 'magento-slip-' . $shipmentId,
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 300) {
    throw new RuntimeException($body);
}
$job = json_decode($body, true); // id, status=queued

Details for this setup

PDF path for a Magento packing slip

Use content_type pdf and exactly one of content (standard base64) or content_url (an http or https URL the agent can download). A private file must be fetched by your server and sent as base64, or exposed as a short-lived URL. On Windows the agent asks a PDF app to print to the named queue; if none is registered, the failure text names Adobe Reader or SumatraPDF as examples. macOS and Linux use lp.

Adobe Commerce is the same API

Hosted or self-hosted, the print call is identical. The agent still has to run in the warehouse, not inside Adobe's cloud.

Questions

Is there a Magento Marketplace extension?

No. You write the observer. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.

Can I print the invoice PDF too?

Yes, as another job with its own key and, if needed, another printer_code.

The observer times out.

POST should return as soon as the job is queued. Do not wait for the physical printer inside the HTTP request that saves the shipment.

Multiple websites?

Same organization can hold many printers. Isolate brands with separate API keys and organizations if staff must not see each other's devices.

Related guides

  • How to auto-print Shopify packing slips

    Render a Shopify packing slip to PDF in your app and send it to the bench printer. PrintBase has no Shopify plugin; the call is a normal print job.

  • How to auto-print BigCommerce shipping labels

    Print a BigCommerce shipping-label PDF from the app that receives the order webhook. No PrintBase BigCommerce app is included.

  • How to auto-print WooCommerce shipping labels

    Take the shipping-label PDF your WooCommerce shipping plugin produced and print it through the API. PrintBase does not replace that plugin.

  • Print ESC/POS receipts from PHP

    From PHP, curl an ESC/POS payload to the print API. Shared hosting is enough because the call is outbound HTTPS.

Free plan: 100 jobs a month on one computer, no card.

Create a free accountRead the API docs
PrintBase

PrintBase connects your applications to physical printers anywhere - securely, reliably, and in real time.

Product
Receipt PrintingLabel PrintingDashboardDevicesWebhooks
Resources
DocsBlogStatusAPI ReferenceDownloadPrintBase vs PrintNodePrintNode PricingFAQ
Guides
All guidesIntegrationsPrintersCode samplesComparisonsUse casesTroubleshooting
Company
ContactSecurityPrivacy

© 2026 Aveniq Technologies OÜ. All rights reserved. PrintBase is a service of Aveniq Technologies OÜ.

PrivacyTermsRefunds