> For the complete documentation index, see [llms.txt](https://help.orderdesk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.orderdesk.com/guided-walkthroughs/templates-emails-and-order-documents/how-to-create-pdf-files-for-order-documents.md).

# How to Create PDF Files for Order Documents

Order Desk allows you to create PDF files from an order document template and then either attach the PDF as a packing slip on an order or attach the file to an outgoing email.

For more information on working with order document templates, review [this guide](/guided-walkthroughs/templates-emails-and-order-documents/how-to-work-with-order-documents.md).

### Create PDF Files

PDFs can be created with a [rule](/start-here/getting-started-series/quick-start-how-customizable-is-order-desk-really.md#the-order-desk-rule-builder).

In the Rule Builder, select the **Order Rule** rule type:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FtdrHNyp9fF6MaYWbjzma%2Flegacy-fe6c39653f752db90331.png?alt=media)

Select the event that needs to happen for PDFs to be created. This will most likely be Order is Imported, but this will be your preference:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FXl7T4WOh68bGZXKA0kLq%2Flegacy-9d6ce74f38c7599a80f6.png?alt=media)

Under the Filters & Actions tab, set any filters if you need to determine which orders will get a PDF. For the action, select **Create PDF** and choose the template that should be used for this PDF:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FXukWt6tYyq5ZflFtOt8S%2Flegacy-0822a62da6a2e810703e.png?alt=media)

This rule will run a Create PDF action, which means you can now use the **PDF Created From Order** event to set up more rules after the PDF is created.

Please *do not add* any additional actions to this Create PDF rule. Sometimes additional actions will run before the PDF is finished being created, which will have unintended consequences. Instead, create a second rule with the PDF Created From Order event to add any additional actions that need to take place after the PDF is created.

After your rule starts running on orders, you can find the PDF in the order metadata.

Scroll to the bottom of an order page and you’ll see pdf\_ followed by the template ID:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FQAyy1dtPfS9DKHMCUqKn%2Flegacy-2896cdc65c691c174135.png?alt=media)

**Send Packing Slip with Order**

Some Print on Demand and fulfillment integrations can receive a packing slip when an order is submitted to them. Check the specific integration guide to find out if the ones you use accept the PackingSlip field. If they do, follow these instructions.

To set this up, after creating the PDF with a rule, create a new rule using the **PDF Created From Order** event:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FBtkcZtIN6ynEvSwQLjKQ%2Flegacy-9e5a7856247b16f2a9f6.png?alt=media)

Select **Set Checkout Data Receipt URL** as the action. For the Field Name add PackingSlip, then select the template you are using as your PDF:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FhEZkZsn6Vfx2fSTx93Oa%2Flegacy-569b1ffc9dc8c8402abf.png?alt=media)

When this rule runs, the link to the PDF will be added as a PackingSlip to the checkout data field on the order and will be sent to the printer when the order is submitted:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2Fzk2gVNCxUYkbihTDo3jK%2Flegacy-9361fe86ed91d496d681.png?alt=media)

**Attach to an Email**

To add the PDF as an email attachment, get the PDF value from the order metadata:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FCctCQS83WTUQeIxK7cTw%2Flegacy-7941f9cc7548fc9460ad.png?alt=media)

Add this to the **Attachment Field Names** field in the email template where you want it added:

![](https://251457507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQOLMUJWMYtrpQ7Oxxca%2Fuploads%2FNzCubqOqypPtLTUVi7Om%2Flegacy-9c58e4aeb7a8bfece962.png?alt=media)

Multiple field names can be entered, separated by comma. Order Desk will first look in the checkout data, then in the order metadata for the information to be attached to an email.

For more information on working with email templates, please see [this guide](/guided-walkthroughs/templates-emails-and-order-documents/how-to-work-with-email-templates.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.orderdesk.com/guided-walkthroughs/templates-emails-and-order-documents/how-to-create-pdf-files-for-order-documents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
