A Vendure plugin that enables the download of various types of PDF files for orders, such as quotations, packing slips, and shipping labels.
vendure-config.ts:AllowPDFDownload permission, or that you are super admin.Download PDFYou can also download multiple PDF's in the order list. This is currently limited to 10 files, because PDF generation runs in the main instance, not the worker.
If you're encountering a 403 Forbidden error in the Admin UI even after granting the correct permissions to your user (e.g., SuperAdmin), you may need to explicitly configure the token method used by the Admin UI to match your server configuration.
Add the following to your AdminUiPlugin configuration to ensure compatibility:
This ensures that the Admin UI and the Vendure server are using the same token method (bearer), which is particularly important if your server is configured with both "bearer" and "cookie" token methods.
To make Puppeteer work on Docker, you need some additional steps in your Dockerfile. This is the Dockerfile we use ourselves:
A customer can download a PDF file by accessing the url /order-pdf/download/<CHANNEL_TOKEN>/<ORDER_CODE>/<TEMPLATE_ID>/<ORDER_EMAIL_ADDRESS>. For example: /order-pdf/download/my-channel-token/ORD1234XYZ/1/hayden.zieme12@hotmail.com. This means a user should know the order code and the corresponding email address before she can download a PDF for the order. It's a plain GET request, so you can include these links, for example in emails you send to your customers.
You can query the available public templates via the shop api using the query below. You can then use the returned ID to construct the download URL.
If you want to disable this behavior, you can supply allowPublicDownload: false in the plugin init arguments.
If you need custom data, or more relations in your template, you can supply a custom data loading function. All data returned from this function is passed into your Handlebars HTML template.
myCustomProp will now be available in all your templates.
By default, the plugin uses TypeOrm's text to store the template in the DB. This might not be enough, for example when you'd like to add base64 encoded images to your picklists. This will result in the error ER_DATA_TOO_LONG: Data too long for column 'templateString'. You can specify your DB engine with an env variable, and the plugin will resolve the correct column type: