Extensions

Search Extensions

PDF Tickets

👋 This extension is compatible with our legacy emails, and we are no longer maintaining it. We have released Wallet Plus, a new add-on to manage digital tickets like PDFs and Apple Wallet passes.

ℹ️ This extension does not support:
Tickets Commerce with PayPal or Stripe
The new Event Tickets Emails functionality, introduced in ET 5.6.0

Event Tickets offers RSVPs and tickets purchased with PayPal or Stripe, while Event Tickets Plus allows you to sell tickets via Easy Digital Downloads and/or WooCommerce.

When a customer buys one or more tickets, they receive an email confirmation with a copy of each attendee’s ticket, including the QR code and Attendee Additional Information if you have Event Tickets Plus.

Emailed PDFs

With this PDF Tickets extension activated, the email will include a PDF attachment of each attendee ticket. If your customer purchases two WooCommerce tickets in a single transaction, three emails will be sent:

  1. Your tickets from {site_name}
  2. Your {site_name} order receipt from {order_date}
  3. [{site_name}] New customer order ({order#}) – {order_date}

The first is from Event Tickets Plus and will include two separate PDF attachments, one per attendee. The second also goes to the customer but is the standard WooCommerce order confirmation email. The third is the notification that goes to the site administrator, not the customer.

This extension’s PDF attachments (one per attendee within the order) will be included in only the first Your tickets from {site_name} email. The last two emails do not have the PDF(s) attached.

wp-admin Attendees Report

With this extension active, the Attendees Report displays a “PDF Ticket” link for each attendee:

PDF ticket links as seen when viewing Attendees Report from the WordPress admin

Viewing PDFs

If you study the screenshot above, in the bottom-left corner, you will see the link to the PDF ticket: /tickets_download/5a25cf0ad099d153922935

All of this extension’s PDF files are stored in the top-level uploads directory (even if you have month- and year-based folders enabled in the Media settings), and the file names are in this format: tribe_tickets_{randomly_generated_string}.pdf

The {randomly_generated_string} part of the filename is stored in the WordPress database as a custom field in the attendee’s ticket.

Once this link is clicked, it will load the PDF file in the visitor’s browser, according to each browser’s default view settings:

Example PDF ticket as seen in the Google Chrome browser

Note, that the tickets sent as attachments might have a different filename.

You might wonder how a PDF file gets created if you have pre-existing orders at the time of activating this PDF Tickets extension. The extension has logic to auto-create the PDF on the fly, saving it to your Uploads directory and then loading the newly-created PDF in the browser, all without the user noticing that the PDF didn’t exist on the server in advance of their request.

Because of this on-the-fly functionality, you are able to delete some or all the tribe_tickets_….pdf files from your Uploads directory. For example, you might choose to do so after you have a large event conclude. Of course, we always recommend having a restorable database and file backups before modifying anything on your site, manually or programmatically.

Note that PDF tickets exist on your file server but are not added to the WordPress Media Library. There is an action hook available if you would like to add custom code whenever a PDF is uploaded to the Uploads directory.

Regarding security and privacy: the PDFs on your server (or able to be created on-the-fly) are unprotected; they do not require authentication (being logged in as the applicable customer). While security through obscurity is not protective, we at least add a {randomly_generated_string} at the end of the filename to avoid ultra-simplistic file names. If you have concerns about unauthorized access to tickets, you could customize this extension’s code to your needs or choose not to use this extension at all.

If you need to support special characters: we have included mPDF’s bundled/default DejaVu font files (which support a wider range of characters) and, as of Version 1.1.0, you can implement this snippet to use this font instead of the system font:

/**
 * Event Tickets: PDF Tickets extension version 1.1.0+: Override mPDF arguments
 * to unset the 'mode' => 'c' (which says to use the system's default fonts).
 *
 * Implementing this snippet will make it so mPDF's default DejaVu font
 * (screenshot: https://cl.ly/3A3w3X1x1731) is used, which supports a wider
 * range of special characters than system fonts (screenshot: https://cl.ly/3Q162V0R403O).
 *
 * @link https://gist.github.com/cliffordp/fc28362e889bf740c8c08d38b46d7475
 * @link https://mpdf.github.io/reference/mpdf-variables/overview.html An outdated reference.
 * @link https://theeventscalendar.com/extensions/pdf-tickets/
 */
add_filter( 'tribe_ext_pdf_tickets_mpdf_args', function ( $mpdf_args ) {
	if ( isset( $mpdf_args['mode'] ) ) {
		unset( $mpdf_args['mode'] );
	}

	return $mpdf_args;
} );

Please read the snippet’s comments and reference Best Practices for Implementing Custom Code Snippets for how to implement custom code snippets.

Community Events Tickets Attendees Report

If you have our Community Events Tickets add-on, the Attendees Report exists on the front-end for each event, very similarly to the wp-admin Attendees Report, and also includes a link to each attendee’s PDF Ticket:

PDF ticket links as seen when viewing Attendees Report from Community Events

“Failed to open dir…”

In some hosting environments, the extension might produce an error with a message similar to the following:

CRITICAL Uncaught UnexpectedValueException: DirectoryIterator::__construct(/tmp/): failed to open dir: Permission denied in /.../wp-content/plugins/tribe-ext-pdf-tickets/vendor/mpdf/mpdf/src/Cache.php:87

This can happen when the system does not have write permission for the temporary directory. The issue might be circumvented with the following snippet that will try to change the temporary directory to wp-content/uploads.

add_filter( 'tribe_ext_pdf_tickets_mpdf_args', 'change_pdf_tickets_temp_folder' );

function change_pdf_tickets_temp_folder( $args ) {
    $tmpdir = wp_get_upload_dir();
    $args['tempDir'] = $tmpdir['basedir'];

    return $args;
}

 

Changelog

  • Version 1.2.4
    • July 17, 2023
    • Version – PDF Tickets is only compatible with PHP 7.4 or later.
    • Version – PDF Tickets is only compatible with Event Tickets 5.6.2 or later.
    • Version – PDF Tickets is only compatible with Event Tickets Plus 5.7.2 or later.
    • Version – PDF Tickets is only compatible with Community Tickets 4.9.3 or later.
    • Fix – Correct some incompatibility with the new TEC container structure.
  • Version 1.2.3
    • April 27, 2023
    • Fix – Update the attachment handling for WooCommerce tickets in Outlook.
    • Tweak – “WooCommerce tested up to” version changed from 4.2.0 to 7.6.1.
  • Version 1.2.2
    • Released June 10, 2020
    • Fix – Update mPDF library version so this plugin now works with PHP 7.4.
    • Tweak – “WooCommerce tested up to” version changed from `3.7.0` to `4.2.0`.
  • Version 1.2.1
    • Released September 5, 2019
    • Tweak – Now requires Event Tickets Plus version 4.7 or newer
    • Tweak – “WooCommerce tested up to” version changed from 3.5.7 to 3.7.0
    • Fix – Attendee Information from Event Tickets Plus now appears correctly at the time of emailing [120683]
    • Fix – Bulk completing WooCommerce Orders only includes each Order’s applicable PDF attachments [116980]
    • Fix – No longer throws a fatal error when Permalinks are disabled
  • Version 1.2.0
    • Released March 29, 2019
    • Feature – Ability to have a PDF Ticket template separate from the Email template by creating a full HTML DOM file at [your-theme]/tribe-events/tickets/pdf-tickets.php [122414]
    • Fix – Compatibility with the latest Event Tickets and Event Tickets Plus releases [122622]
    • Fix – Avoid fatal on Events List admin screen when Event Tickets Plus is not active
    • Tweak – Fixed notices around caching directories
    • Tweak – Add “WC tested up to” to the plugin header to avoid the “Not tested with the active version of WooCommerce” message within the WooCommerce Status page [117703]
    • Tweak – Update mPDF library from version 7.0.3 to version 8.0.0
  • Version 1.1.0
    • Released May 16, 2018
    • Feature – Added support for Tribe Commerce PayPal tickets
    • Feature – Added new public methods: delete_all_tickets_for_event(), delete_all_tickets_for_event(), delete_single_pdf_ticket()
    • Tweak – Delete PDF files from the server whenever they are detected to be outdated, such as when the Event or one of its attached Venues or Organizers is updated or when an Attendee’s Additional Information is updated — added multiple hooks to disable deleting upon these triggers if you choose
    • Tweak – To be more extensible, made these methods public: ticket_link(), get_pdf_link(), get_direct_pdf_url(), get_pdf_path()
    • Tweak – Update mPDF library from version 7.0.0 to version 7.0.3
    • Tweak – Changed mPDF default arguments to default to letter size (8.5 x 11 inches) instead of its default A4 (8.27 x 11.69 inches)
    • Tweak – Added new tribe_ext_pdf_tickets_mpdf_args filter to customize the arguments sent to mPDF
    • Fix – Protect against fatal error triggered when Event Tickets plugin got deactivated while this extension was still active
    • Fix – Add additional action hooks for when a ticket is modified and then force regenerating the PDF so it always matches the HTML/email version
    • Fix – WooCommerce – PDF email attachments now work according to your “When should attendee records be generated?” and “When should tickets be emailed to customers?” settings
    • Fix – WooCommerce – PDF email attachments now work when performing “Resend tickets email” from WooCommerce’s “Edit order” wp-admin screen
    • Fix – Corrected text domain, load text domain, and add a .pot file to make this extension plugin translatable
  • Version 1.0.0
    • Released December 6, 2017.
    • Requirements:
      • PHP version 5.6 or greater
      • Event Tickets version 4.5.2 or greater
      • (optional) Event Tickets Plus version 4.5.6 or greater
      • (optional) Community Events Tickets version 4.4.3 or greater
    • License is GPLv2 (not “GPLv2+”) to be compatible with mPDF’s “GPL-2.0-only” license in its composer.json file

Download Extension

👋 Heads up! We provide limited support for extensions, but you can still open a ticket over at our Help Desk to report any issues.
Install Instructions