Click Here

How to have the plugins processed when genrating PDF documents of content items (for Joomla 1.0.x)?
Written by kksou   
Sunday, 15 June 2008

In a standard Joomla 1.0 installation, you can generate a PDF version of a content item by clicking on the pdf icon appearing in the top right corner of the content item page.

However, if you have installed some plugins or mambots such as the Include Content Item or the googleAds plugins, you will find that the plugin do not get processed during the generation of the PDF documents. As as result, you will see the plugin tags such as {googleAds} or {include_content_item}, appearing in the PDF documents! This is, of course, undesirable.

This article shows you how to have the plugins processed during the generation of the PDF documents for content items.

Note: the steps below are for Joomla 1.0.x. If you're using Joomla 1.5.x, please refer to How to have DirectPHP plugin process RSS feed (for Joomla 1.5.x)?.


In the original Joomla installation, there is no trigger during the generation of PDF documents. When there is no trigger, none of the plugin gets called. In order for the plugins to be processed, we need to add a trigger.


All you need is to add 6 lines to have plugins processed during the generation of PDF documents!

  1. Go to the folder <Joomla root folder>/includes, you will see a file called pdf.php.
  2. Open this file pdf.php in your favorite editor.
  3. Go to around line 112, and add the 6 lines highlighted in yellow as shown below:
  4. $txt1 = $row->title;
    $pdf->ezText( $txt1, 14 );
    $txt2 = AuthorDateLine( $row, $params );
    $pdf->ezText( $txt2, 8 );
    $txt3 = $row->introtext ."\n". $row->fulltext;
    global $_MAMBOTS;
    $params = array();
    $row->text = $txt3;
    $_MAMBOTS->loadBotGroup( 'content' );
    $results = $_MAMBOTS->trigger( 'onPrepareContent', array( 1, &$row, &$params, 0) );
    $txt3 = $row->text;
    $pdf->ezText( $txt3, 10 );

  5. Save and close this file.

That's it! Now try generating the PDF documents. You should find all the plugin tags disappear in the PDF documents as they get processed by the respective plugins.


For plugins such as googleAds, you will find that the plugin gets processed, but the resulting google Adsense codes do not get run by Joomla 1.0. (Joomla 1.5 works fine.)

For such plugins on Joomla 1.0, the only way may be is to remove the plugin tags from the content item during the generation of PDF.

For the googleAds plugin, I've written the corresponding plugin to remove the tag from the content item here. (will be released in a couple of days time)