{"id":132310,"date":"2021-03-10T13:56:00","date_gmt":"2021-03-10T12:56:00","guid":{"rendered":"https:\/\/spotler.com\/?post_type=blog&#038;p=132310"},"modified":"2024-09-22T10:13:55","modified_gmt":"2024-09-22T08:13:55","slug":"dynamic-pdf-attachments","status":"publish","type":"blog","link":"https:\/\/spotler.com\/en-gb\/blog\/dynamic-pdf-attachments","title":{"rendered":"Dynamic PDF Attachments: sending PDF files the right way"},"content":{"rendered":"<p><strong>Where marketing emails aim to sell, transactional emails are there to help your customers. Help them with a request, help them with their progression, ease their minds. To do so, you sometimes need to send attachments with your emails. This article introduces you to a specific kind of attachment: The (dynamically generated) PDF file.<\/strong><\/p>\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2 class=\"wp-block-heading\">Why you should attach&nbsp;PDF attachments<\/h2>\n<p>Attachments come in all shapes and sizes: Office documents, HTML, calendar items, PDF files\u2026 There are about 550 different types of file types! Though attachments in emails have&nbsp;<a href=\"https:\/\/mclaneintel.com\/need-know-email-attachment-limitations\/\" target=\"_blank\" rel=\"noreferrer noopener\">technical limitations<\/a>, using them increases the value of your emails.<\/p>\n<p>Transactional emails rely on the relationship between your recipients and your brand. These emails aim to help their recipients, and so should your attachments. They have some major advantages to your recipients. For instance they can easily save, share, edit, and review files, or import the file into another system (mostly .csv).<\/p>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">PDF as industry standard<\/h3>\n<p>The PDF format allows portability for the document, meaning it will look the same in mobile clients as in native desktop view. Fonts, images, margins et cetera. Besides, PDF files are supported by (pretty much) every device, allow interactivity within the document, and can be in designed in various shapes and sizes.<\/p>\n<p>This makes PDF the de facto standard for exchanging files. Whether it\u2019s between Google Drive and iCloud or your systems and your recipient\u2019s inbox. It is the only format that allows both the sending and the receiving party to view the file in the exact same way \u2013 even in inbox preview.<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/spotler.com\/wp-content\/uploads\/2024\/09\/dynamic-pdf-attachments-inboxpreview-1024x647.jpg\" alt=\"\" class=\"wp-image-78951\"\/><\/figure>\n<p>In some cases, it\u2019s better to not attach a file to your email but refer to it. For instance, when the file contains personal information, exceeds the file size limit or when the attachment is not in PDF format. In most cases, referring to the location of the file will suffice, like embedding a &lt;hyperlink&gt; in your email or refer to a file in the user\u2019s login portal.<\/p>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">Times you shouldn&#8217;t send attachments<\/h3>\n<p>Transactional email is the most viable way to send attachments, contrary to marketing emails. Sending PDF files with your marketing emails will do more harm than good to your deliverability. In some cases, sending PDF files is not the best idea, even with transactional email.<\/p>\n<p>PDF attachments are helpful when the email has an administrative task, but do not accompany emails that are only sent to notify the recipient or let him do one simple task (click a button to reset password) with PDF files. This will only confuse the recipient and is a waste of inbox space.<\/p>\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2 class=\"wp-block-heading\">The difference&nbsp;between triggered and dynamic PDFs<\/h2>\n<p>When you\u2019re adding attachments to your emails, there basically are two ways of doing so: either via a trigger or dynamical. Triggered PDFs are the ones that must already be generated and located somewhere your email platform can find it.<\/p>\n<p>Host your files on your website, Google Drive or uploaded to your platform. This way, the email platform can retrieve the PDF and send it alongside the email in a webmail, SMTP, or API process.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/spotler.com\/wp-content\/uploads\/2024\/09\/dynamic-pdf-attachments-triggerbased-1024x520.jpg\" alt=\"\" class=\"wp-image-78948\" style=\"aspect-ratio:1.9692307692307693;width:841px;height:auto\"\/><figcaption class=\"wp-element-caption\">You&#8217;re unable to alter a trigger-based PDF&nbsp;<em>en route<\/em><\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">Dynamic attachments<\/h3>\n<p>SMTP providers, like ourselves, generate your transactional emails when needed. Dynamically generated PDFs work the same way: PDF templates filled with the same variables as your transactional emails allow you to retrieve more data from your source systems, and create PDF attachments in your style.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/spotler.com\/wp-content\/uploads\/2024\/09\/dynamic-pdf-attachments-dynamicbased-1024x520.jpg\" alt=\"\" class=\"wp-image-78949\"\/><figcaption class=\"wp-element-caption\">Display of how dynamically generating a PDF works<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">When should I use trigger-based or dynamic attachments?<\/h3>\n<p>In the email delivery process, trigger-based attachments are the easiest solution. You generate them once and send them alongside your email in the SMTP process. Yet sometimes, trigger-based PDF attachments can be ugly and impersonal.<\/p>\n<p>Dynamic attachments are great when data needs merging or an attachment needs to be hyper-personalized. Invoices, entrance tickets, and periodical reports, for example, are great for this. But dynamic PDF attachments can be hard to develop due to some technical details in XHTML. So having all your PDF attachments generated dynamically won\u2019t pay off.<\/p>\n<p>Ask yourself the following questions when considering the type of attachment to send:<\/p>\n<ol class=\"wp-block-list\">\n<li>Is my attachment supposed to be interactive or engaging?<\/li>\n<li>Do I need data from multiple source systems to create the PDF?<\/li>\n<li>Do I need to be able to change the way my PDFs look, add logo\u2019s, variables and\/or content?<\/li>\n<\/ol>\n<p>If the answers to two or three of these questions are \u2018yes\u2019, you consider dynamically generating PDFs. Obviously, you can use both trigger-based and dynamic attachments in the same email if you wish to do so.<\/p>\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2 class=\"wp-block-heading\">Creating dynamic attachments (with Flowmailer)<\/h2>\n<p>You can create trigger-based PDFs yourself or let your CMS or invoicing system do so. Dynamic attachments, however, require a specialized platform. To create dynamic PDFs, you need to first collect the data you need. Use that data to personalize your content in an XHTML template that you convert to PDF.<\/p>\n<p>Every business nowadays uses various systems to gain information about their customers. What they like, what they do, what they buy. The information they leave with you, you can use to personalize your communications.<\/p>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">Use data to personalize content<\/h3>\n<p>Once you have collected the data you need, you can personalize your content. Our previous examples already showed you what personalization can do, but there&#8217;s more. Variables allow your PDFs to be unique to every recipient. Did your customer order a new pair of jeans paid by invoice? Add a link or QR code to your attachment for later payment.<\/p>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">Creating XHTML<\/h3>\n<p>Dynamic PDF files are not retrieved from a source system or an external URL, but generated in <a href=\"https:\/\/spotler.co.uk\/platform\/transactional-email\" target=\"_blank\" rel=\"noopener\">Flowmailer<\/a>. XHTML gives you all the power that &#8216;normal&#8217; Flowmailer templates also have: you can start working with variables and macros. This allows you to get much more out of your PDF attachment.<\/p>\n<p>Unfortunately, XHTML to PDF has more technical limitations than normal email. So you need to be a bit more careful in your code. Some things don&#8217;t work or different. Although there is no exact list of them, you can assume that fonts, lines and exact placement will not work as well. Moreover, we always recommend working in cm instead of px.<\/p>\n<h3 class=\"wp-block-heading has-blue-color has-text-color\">PDF generation in Flowmailer<\/h3>\n<p>To get started with dynamic PDF attachments, you need to arrange a few things in your <a href=\"https:\/\/spotler.co.uk\/platform\/transactional-email\" target=\"_blank\" rel=\"noopener\">Flowmailer<\/a> account. Source systems from which you want to retrieve the data, for example, need to be linked to Flowmailer or accessible to retrieve data. When you create a template (Template &gt; Type XHTML to PDF) you can retrieve that data when an email is pushed through Flowmailer.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/spotler.com\/wp-content\/uploads\/2024\/09\/dynamic-pdf-attachments-templateflowmailer-1024x340.png\" alt=\"\" class=\"wp-image-78947\" style=\"aspect-ratio:3.011764705882353;width:587px;height:auto\"\/><figcaption class=\"wp-element-caption\">To create a<strong>&nbsp;<\/strong>PDF template, choose XHTML to PDF<\/figcaption><\/figure>\n<\/div>\n<p>In the \u201cFlow\u201d of that email you can then add the PDF template as Flowstep. In this way, a dynamic PDF attachment will be added to the standard email. Of course you can also change the original message in the same Flow, without affecting the PDF attachment:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/spotler.com\/wp-content\/uploads\/2024\/09\/dynamic-pdf-attachments-flowstepflowmailer-1024x178.png\" alt=\"\" class=\"wp-image-78950\" style=\"aspect-ratio:5.752808988764045;width:547px;height:auto\"\/><figcaption class=\"wp-element-caption\">Adding the PDF as a\u00a0Flowstep in <a href=\"https:\/\/spotler.co.uk\/platform\/transactional-email\" target=\"_blank\" rel=\"noopener\">Flowmailer<\/a><\/figcaption><\/figure>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can use dynamically generated PDF files in your transactional email. Do you want to know why and how you can do this the right way?<\/p>\n","protected":false},"author":46,"featured_media":115716,"template":"","cat_industry":[],"cat_topic":[],"class_list":["post-132310","blog","type-blog","status-publish","has-post-thumbnail","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/blog\/132310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/users\/46"}],"version-history":[{"count":1,"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/blog\/132310\/revisions"}],"predecessor-version":[{"id":132311,"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/blog\/132310\/revisions\/132311"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/media\/115716"}],"wp:attachment":[{"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/media?parent=132310"}],"wp:term":[{"taxonomy":"cat_industry","embeddable":true,"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/cat_industry?post=132310"},{"taxonomy":"cat_topic","embeddable":true,"href":"https:\/\/spotler.com\/en-gb\/wp-json\/wp\/v2\/cat_topic?post=132310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}