WP Manifestindependent plugin directory
manifest / media / wp-pdf-export

WP PDF Export

WordPress plugin to export logged‑in users’ posts into styled PDFs via shortcode. Supports custom templates from the active theme, AJAX generation with spinner, per‑user caching, and optional QR codes. Ideal for forms, applications, and document automation.

by Your Name · github.com/cerebrocodes/wp-pdf-export

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/cerebrocodes/wp-pdf-export/archive/refs/heads/main.zip

Readme

WP PDF Export

A WordPress plugin that lets logged‑in users download their own posts as a styled PDF using a simple shortcode.

Features

  • Shortcode‑driven PDF generation: [wp-pdf …]
  • Exports only posts authored by the current user (post_author = current_user_id)
  • Supports multiple post types in one PDF
  • Custom templates from your active theme or child theme
  • AJAX generation with loading spinner – no page reload
  • Per‑user PDF caching (stored for 4 months)
  • Maximum 15 posts per export (with a note in the PDF)
  • Optional QR code support (requires chillerlan/php-qrcode)
  • Built on Dompdf – modern CSS support (flexbox, basic grid)

Requirements

  • WordPress 5.0 or higher
  • PHP 7.4 or higher
  • Dompdf library (bundled in vendor/dompdf/)

Installation

  1. Upload the wp-pdf-export folder to /wp-content/plugins/.
  2. Ensure the vendor/dompdf/ directory exists and contains Dompdf.
    • If missing, download Dompdf 2.x/3.x from dompdf/dompdf and place it inside vendor/dompdf/.
  3. Activate the plugin through the Plugins screen.
  4. (Optional) For QR code support, run composer require chillerlan/php-qrcode inside the plugin folder.

Usage

Add the shortcode to any page or post:

[wp-pdf post-types="solicitante,conyugue" count="0,2" template="solicitante,conyugue" text="Download PDF"]

Shortcode Parameters

Parameter Description
post-types Comma‑separated post type slugs
count Number of posts per type, matched by position. 0 = unlimited (up to 15 total)
template Template name (without .php), matched by position
text Button text (default: “Download PDF”)

Templates

Built‑in templates live in:

wp-pdf-export/templates/

To override a template, create a folder in your active theme:

your-theme/wp-pdf-export/

Place your PHP template inside, using the same filename as the plugin template.
Each template receives a $post object. Use get_post_meta() to access custom fields.

Example template:


<h1><?php echo esc_html( $post->post_title ); ?></h1>
<p><?php echo esc_html( get_post_meta( $post->ID, 'apellido', true ) ); ?></p>

Caching

PDFs are cached per user in wp-content/uploads/wp-pdf-export/.
The cache expires after 4 months. Delete files manually to force regeneration.
Limitations

    Only logged‑in users can generate PDFs.

    Only published posts by the current user are included.

    Complex JavaScript blocks (sliders, maps) will not render in PDFs.

    Some advanced CSS features may not be fully supported by Dompdf.

Read the full README on GitHub →