> ## Documentation Index
> Fetch the complete documentation index at: https://pitchprint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Automation: Sending your PDF file to Printer

> Wire a PitchPrint webhook into a Zapier Zap so every completed order emails the print-ready PDF and order details to your printer.

<Frame>
  <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73ce072c7d3a03f89db5be/file-cLldldsgxy.png" alt="PitchPrint webhook connected to Zapier, which emails the PDF output to a printer" />
</Frame>

In this guide, we will go through the process of automating delivery of PitchPrint's output files by sending them as an email attachment to your printer along with the order details. This can also be used to save the file into a Dropbox, OneDrive or Google Drive folder.

To achieve this, we will be using the Webhooks feature of PitchPrint so If you are not familiar with this, we kindly advise you  [go through that tutorial here](/docs/tutorial/webhooks).

So here are the steps we will follow:

<Steps>
  <Step title="Create a new Zap in Zapier">
    Register or login to [Zapier](https://zapier.com) and click the **Make a Zap** button on the top right hand corner. A Zap is simply a workflow link you create between apps on Zapier. [You can read more here](https://zapier.com/help/what-is-zapier/)

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73cc642c7d3a03f89db5a6/file-pezNYbsZBd.png" alt="Zapier home page with the Make a Zap button in the top right hand corner" />
    </Frame>
  </Step>

  <Step title="Open the Zap creation dashboard">
    That should take you to the Zap creation dashboard.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73d3fe2c7d3a03f89db5f4/file-KEQS76q2DC.png" alt="Zap creation dashboard in Zapier" />
    </Frame>
  </Step>

  <Step title="Search for the Webhooks by Zapier app">
    In the search box, type in "***webhook***" and select the Webhooks by Zapier app.
  </Step>

  <Step title="Select Catch Hook">
    Select ***Catch Hook*** in the next form that appears and click the ***Save + Continue*** button:

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73d4fa2c7d3a03f89db5fc/file-LoN16TZCxw.png" alt="Catch Hook selected as the webhook trigger, with the Save + Continue button" />
    </Frame>
  </Step>

  <Step title="Set the Child key to products">
    For the Child key, type in **products** and continue:

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73d8190428631d7a89fd05/file-ORyyyOrkK8.png" alt="Child key field filled in with products" />
    </Frame>
  </Step>

  <Step title="Copy the webhook URL Zapier generates">
    In the next screen, Zapier will give you a unique URL. This is the URL that PitchPrint will invoke once an action occurs in your PitchPrint account. So, copy this URL into your clipboard by clicking the ***Copy*** button.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73d9e20428631d7a89fd14/file-KBgpO3Kjid.png" alt="Zapier screen showing the generated webhook URL alongside a Copy button" />
    </Frame>
  </Step>

  <Step title="Open your PitchPrint webhooks page">
    Now, we need to put this URL in PitchPrint and then trigger an event so that PitchPrint sends a sample data to Zapier. To do this, navigate to your [PitchPrint's Webhooks admin page](https://admin.pitchprint.io/webhooks).
  </Step>

  <Step title="Add a webhook endpoint">
    Click the Add a webhook Endpoint button on the top right hand corner.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b7306db0428631d7a89f6c3/file-ipKqDov6zt.png" alt="PitchPrint Webhooks page with the Add a webhook Endpoint button in the top right corner" />
    </Frame>
  </Step>

  <Step title="Paste the URL and pick the order completed event">
    This should give you a dialog box. In the dialog, paste the URL you copied from Zapier and for events, select the option "**An Order is Completed**" and Submit the button. This simply creates a Webhook trigger that gets called whenever an order status changes to ***completed***.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73dbca0428631d7a89fd1e/file-igOoekOTog.png" alt="Webhook endpoint dialog with the Zapier URL pasted and the An Order is Completed event selected" />
    </Frame>
  </Step>

  <Step title="Trigger a completed order to send sample data">
    Now we need to trigger that event to send sample data to Zapier. To do this, you need to create an order and complete that order or open an existing order in your store, change its status to other than completed, save and then change it back to completed and save. Any time an order's status changes to "completed", that event gets sent to PitchPrint and in turn to Zapier through the URL you have provided. Also note, the order should be one with a PitchPrint customization.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73e1cd2c7d3a03f89db673/file-DIDTV3ViXz.png" alt="Store order screen with its status being changed back to completed" />
    </Frame>
  </Step>

  <Step title="Confirm Zapier received the sample data">
    Once that step is completed, let's go back to our Zapier and click the button "**Ok, I did this**". Zapier will check its log based on that URL if any event was sent. Then we should see sample data as shown below:

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73e25f0428631d7a89fd3d/file-OkbhxJMkJo.png" alt="Zapier showing the sample webhook payload received from PitchPrint" />
    </Frame>
  </Step>

  <Step title="Review the captured order fields">
    As you can see, it captures the orderId, the shipping address, product and link to the pdf file, named "**file**". In the next step, we are going to use this data to send an email. So click the Continue button.
  </Step>

  <Step title="Choose Email by Zapier as the action app">
    In the prior steps, we have simply created an event trigger in Zapier. It means we are able to get data into Zapier from PitchPrint. Next, we need to choose what to do with that data. We can send it as email, save it to Dropbox etc.. there are many things we can do with this data. We can even post process the PDF file using other apps. So since we decided to send an email with it, next thing is to **Choose an Action App**. In the search box, type in **email** and select Email by Zapier.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73e3c70428631d7a89fd4a/file-xlpSTv2YaO.png" alt="Action app search results in Zapier with Email by Zapier selected" />
    </Frame>
  </Step>

  <Step title="Select Send Outbound Email">
    With the Send Outbound Email option selected, let's click the ***Save + Continue*** button.
  </Step>

  <Step title="Set the destination email address">
    In the next step, we need to prepare how our email will be processed. For the To field, enter in an email address, this is the destination email address, assuming your printer has one, you can try or send to yourself and see.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73e4900428631d7a89fd50/file-776cdV1Prc.png" alt="Outbound email setup in Zapier with the To field filled in" />
    </Frame>
  </Step>

  <Step title="Attach the PDF file to the email">
    Type in a subject and email body. And for the attachment, we want to attach the PDF file, please note you can also choose to attach a JPEG or PNG file, so you need to click the plus icon on the right edge of the Attachment field and select the **file** option from there

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/60c85e93b48f6d2c75435719/file-Td39pkv675.png" alt="Attachment field with the file value picked from the list of webhook fields" />
    </Frame>

    So that will be our attachment to the email, the PDF File. Click the continue button and you will see details of the email that is about to be sent.
  </Step>

  <Step title="Send a test email">
    Click the Send test Email by Zapier and wait a few minutes to receive the email. You should receive a successful screen as shown

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73e65b2c7d3a03f89db6a3/file-nd4WwCWfE4.png" alt="Zapier success message confirming the test email was sent" />
    </Frame>
  </Step>

  <Step title="Finish and turn on the Zap">
    Click the Finish button and finally Turn ON your Zap.

    <Frame>
      <img src="https://s3.amazonaws.com/helpscout.net/docs/assets/58f1ec6d2c7d3a52b42f8254/images/5b73e6af2c7d3a03f89db6a7/file-zsq6ae6bCt.png" alt="Zap turned on with its on/off toggle enabled" />
    </Frame>
  </Step>

  <Step title="Confirm automated delivery">
    Your Zap should now run automated. Whenever a status completed even it triggered from an order in your store, an email with the PDF attached will be created and sent to the email address you have provided in your Zap.
  </Step>
</Steps>

For the body of the email, you can optionally select from any of the fields in the data returned by the event. So for instance, the subject could be the order ID, the body could be the Shipping Address etc..

The idea is that, we first create a trigger source, which is getting PitchPrint to send the event to Zapier. And from there, you can send the data to any other destination. Or you can even add multiple steps.

## Related articles

<CardGroup cols={2}>
  <Card title="PDF Rendering" icon="file-pdf" href="/docs/tutorial/pdf-rendering">
    How PitchPrint generates print-ready PDFs and its distiller engines.
  </Card>

  <Card title="Ghostscript Arguments" icon="terminal" href="/docs/tutorial/ghostscript-arguments">
    Customize PDF output with Ghostscript conversion arguments.
  </Card>

  <Card title="PDF Uploader" icon="upload" href="/docs/documentation/pdf-uploader">
    Upload PDF files and convert them into editable designs.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.