Blog

Back to blog posts

IFTTT – Convert a URL to PDF and Email PDF as Attachment

Published Jul 08, 2018

This post will provide step by step instructions for converting any web page to a PDF and then emailing that PDF as an attachment using IFTTT (If This Than That). This post assumes you have an account with IFTTT already.

Step 1: Sign up for free

Step 2: Test out the Url to PDF conversion.

Open a new browser window and copy and paste the url below. Replace {ApiKey} and {Url} with your Api Key from api2pdf.com and a url of your choice that you want to convert to a PDF.

https://v2018.api2pdf.com/wkhtmltopdf/url?url={Url}&apikey={ApiKey}

It should generate a PDF from that url you provided. If so, you’re all set to create your applet on IFTTT.

Step 3: Setup the IFTTT Applet Trigger

  • Start by creating a new applet here
  • For the +this, search for “webhooks” and select the Webhooks service.

  • Click receive a web request (it is the only option).
  • Under Event Name, type: pdf_requested

  • Click Create trigger when ready.

Step 4: Setup the IFTTT Applet Action

  • Click the +that to begin setting up the action.
  • Search for Gmail in services.

  • Choose your desired action.

  • Fill out the required fields to your specifications. The important part is the Attachment Url field. Copy and paste the following line into the Attachment Url field.

https://v2018.api2pdf.com/wkhtmltopdf/url?url={{Value1}}&apikey={{Value2}}

Step 5: Call your webhook with the url you want to convert to pdf.

  • Go to your webhook settings by clicking this link here.
  • Copy the IFTTT key shown to you (screenshot redacts my key).

  • Copy and paste the url below into your browser and replace {IFTTT_KEY} with the key you just copied, {Url} with the url you want to convert to PDF, and {ApiKey} with your api2pdf.com API key you retrieved from step 1.

https://maker.ifttt.com/trigger/pdf_requested/with/key/{IFTTT_KEY}?value1={Url}&value2={ApiKey}

When you replace those variables in the url, a PDF of the url will be created and emailed based on the action settings you configured in the applet. That’s all!