This is GPL, only it seems odd to include a license in a program that has twice the size of the license. Modifications to work with PmWiki 2.0, Copyright (c) 2005 by Patrick R. Michaud 17.11.2005 - Daniel Scheibler - add HandleAuth['pdf'] and change ReadPage(...) into RetrieveAuthPage(...) */ if (!defined('PmWiki')) exit(); include('html2fpdf/html2fpdf.php'); define("HOST", $_SERVER["HTTP_HOST"]); define("URI", $_SERVER["REQUEST_URI"]); define("MEM", ini_get('memory_limit') ); define("MAX_TIME", ini_get('max_execution_time') ); # # add the $HandleActions PDF variable array ... # $HandleActions['pdf'] = 'HandlePDF'; SDV($HandleAuth['pdf'], 'read'); function HandlePDF($pagename, $auth = 'read') { global $WikiTitle; // modify WikiTitle $WikiTitle = str_replace(' ', '_', $WikiTitle); $WikiTitle = html_entity_decode($WikiTitle); // read wiki page ! $page = RetrieveAuthPage($pagename, $auth); // define variable $xyz['author'] = 'by '.$page['author']; // pdf author $xyz['name']['page'] = str_replace('.', '_', $pagename); // page name $xyz['name']['pdf'] = $WikiTitle.'_'.$xyz['name']['page'].'.pdf'; // pdf name $xyz['text'] = mv_breakpage($page['text']); // to transform breakpage markup $xyz['title'] = $WikiTitle.' : page '.$xyz['name']['page']; // pdf title $xyz['url'] = 'http://'.HOST.URI; // pdf URL // transform text to html ! $html = change_code(MarkupToHTML($pagename, $xyz['text'])); /* for test ! echo $xyz['text']; echo '\n HTML : '.$html; */ //out pass memory server ini_set('memory_limit', '24M'); ini_set('max_execution_time', 0); // declare a new object pdf $pdf = new HTML2FPDF(); // Disactive elements HTML ... $pdf->DisableTags(''); // generals informations $pdf->SetCompression(1); $pdf->SetAuthor($xyz['author']); $pdf->SetTitle($xyz['title']); $pdf->PutHREF($xyz['url']); // build the page PDF $pdf->AddPage(); $pdf->WriteHTML($html); $pdf->Output($xyz['name']['pdf'], D); // retabli valeur serveur ini_set('memory_limit', MEM); ini_set('max_execution_time', MAX_TIME); } function mv_breakpage($buffer) { $search = array ( "!(:breakpage:)!", /* original version */ "!____!", /* version 2.0.7 */ "!====!", /* version for PmWiki 2.0.beta54 and > */ ); return(preg_replace($search, 'page_break', $buffer)); } function change_code($buffer) { $search = array ( "!

page_break\s

!", "!

!", "!\n!", "!é!", "!è!", "!…!", "!“!", "!”!", "!‘!", "!’!", "!—!", "!−!", "! !", "!™!", "!©!", "!€!", "!®!", ); $replace = array ( '', "", " ", "é", "è", "...", "\"", "\"", "'", "'", "--", "-", " ", "™", "©", "€", "®", ); return(preg_replace($search, $replace, $buffer)); } ?>