Providing PDF downloads of your WordPress articles can be an effective way to engage your visitors with longer content.

In this tutorial, we will cover the following points:

  • Why you should consider offering a PDF version of your content.
  • Why it's better to manually create PDF versions of your articles rather than using plugins.
  • How to manually create a PDF version of a WordPress post.
  • Other ways to use PDF files with WordPress.

Why offer a PDF version of your content?

Too much content, so little time, we are told. Or maybe it's just a shortening of attention span.

Whatever the reason, longer content requires a greater investment of time and if your visitor decides he or she can't make that investment now, then they click. Although your content clicked on a pageview on your statistics, there is no productive time on site and no real commitment.

While there is no guarantee that visitors will interact with your content, providing the same content in a digestible format better suited for later reading, whether through a PDF stored in Apple Books, your Facebook page, or even - and I get everything retro here - printed, might just reduce the incidence of TL; DR.

Manual PDF Generation - Pros and Cons

The only likely downside to manually creating a PDF from a WordPress post or page is that it involves more effort on your part. The advantages are that it has considerable advantages:

  • You can have properly formatted content and complete control over areas like image alignment, fonts, etc.
  • You decide where to place the page breaks.
  • You can add additional elements like watermarks, add access points, etc.
  • You can insert additional content or delete unnecessary sections.
  • You can choose the content to download in PDF.

Creating a PDF is easy. Virtually all of the major word processing applications, from Word to pages to Google Docs, will allow you to create thin format documents that can be exported to PDF. If you don't know where to start, here is a tutorial on how to create PDF file using different platforms (in English).

Once you have created a PDF file, assigning it to a publication takes only a few steps:

1. In the administration interface of your site, go to Media > Add new and download the PDF.

2. In the list of media library tables, you will see your newly downloaded file. Files downloaded directly to the media library are not attached. Click on Join under the "Downloaded to" column.

Wordpress mediatheque pdf

3. Select the appropriate publication (you can also search if you don't see your publication) and click Select at the bottom of the dialog.

Find an item to attach
my WordPress installation is for testing purposes hence the multitude of untitled articles

When you return to the list, you will see that your PDF is now attached to the message you have selected.

But what about showing a link to download the file?

Automatic display of a link to the PDF version

We can do this very easily by using the filter the_content to add a link to any PDF attached to the post:

<?php
 /*
 Plugin Name: Link Vers Fichier Joints
 Plugin URI: http://votresite.com
 Description: Ajouter un lien vers un attachement à votre article 
 Author: BlogPasCher
 Version: 1.0
 Author URI: http://votresite.com
 */
function pdf_add_link( $content ) {
global $post;

if ( !is_single() ) return $content;

$args = array(
    'numberposts' => 1,
    'order' => 'ASC',
    'post_mime_type' => 'application/pdf',
    'post_parent' => $post->ID,
    'post_status' => null,
    'post_type' => 'attachment',
);

$attachments = get_children( $args );

if ( $attachments ) {
    foreach ( $attachments as $attachment ) {
        $content = '<div class="pdf_download"><a href="' . wp_get_attachment_url( $attachment->ID ) . '" target="_blank" >Télécharger PDF</a></div>' . $content;         
    }
}
return $content;
}
add_filter( 'the_content' , 'pdf_add_link' );

This file is available as a plugin (download it, save it as a compressed file and send it to your site) but you can also, if you prefer, simply copy the code into your functions.php file theme.

Manually add download link to PDF

If you don't want to change the code, you can insert a link or button in your content inviting users to download your article in PDF format:

Download pdf version

This will require you to have a little mastery of HTML and CSS. You just need to add the code using Gutenberg HTML Block.

Other uses of PDF for WordPress

Converting WordPress posts to PDF isn't all you can do with PDF plugins. Here are a few other things you can do with PDFs in WordPress:

Download and integrate PDFs on WordPress

Plugins such as PDF Embedder , Algori PDF Viewer et Wonder PDF make it easy to download and embed PDF files into your WordPress content.

Embeded pdf plugin

Integrate PDFs into your business processes

Plugins like E2PDF allow you to create and edit documents and forms new and existing PDFs directly from WordPress, merge and export data from posts, pages and forms WordPress web into PDF documents, and allows visitors to view static or dynamic PDF documents in WordPress.

Convert PDF to WordPress

We've looked at the plugins that convert WordPress to PDF, but you can easily go the other way as well! Plugins like PDF2Post allow you to convert PDF content to WordPress messages.

Wordpress to pdf

As you can see, there are some great PDF plugins available for WordPress if you take the time to research online. If you want to save time, however, I recommend that you subscribe to our newsletter at the bottom of this page. We'll do the PDF'ing for you and let you know about all the great and wonderful things you can do with WordPress.