PDFResources from frontend


I have installed the PDFResources snippet / plugin - It functions well from the manager generating the pdf page on view but how do I fire the snippet from a click or link on the front end.

I have a page of user entered form data and want the user to be able to download a copy as a PDF - how do I fire the snippet from there.



According to the documentation to generate the PDF on the fly, you have to “assign the template variable live_pdf to a template and check this template variable on a resource.”


I did that and it just instantly creates a pdf of the resource does not wait for a click


Can’t you just create 2 resources? One that shows the data to the user as html and links to the other resource to download a PDF version.

1 Like

I like your thinking - maybe that is what you are meant to do


Maybe you can use a Symlink for one of these resources, so you don’t have to duplicate the content.

Alternatively you could extend the plugin with some custom code:
Duplicate the plugin “PDFResource” and deactivated the original one.
Then add some code to the top of your new plugin.

//Check if PDF should be displayed
$resource_id_with_pdf = 12; //change the value to the id of your resource!
if($modx->event->name == 'OnWebPagePrerender') {
    if ($modx->resource->get('id') == $resource_id_with_pdf){
        if (!isset($_GET["pdf"]) || $_GET["pdf"] != "1") {
            return; //don't execute the rest of the plugin

//original plugin code

Now when you call your page with a GET parameter ?pdf=1 it should return a PDF, otherwise it shows the normal page.

<a href="[[~[[*id]]? pdf=`1`]]">Show as PDF</a>