load( $id ); $params = new mosParameters( $row->attribs ); $params->def( 'author', !$mainframe->getCfg( 'hideAuthor' ) ); $params->def( 'createdate', !$mainframe->getCfg( 'hideCreateDate' ) ); $params->def( 'modifydate', !$mainframe->getCfg( 'hideModifyDate' ) ); $row->fulltext = pdfCleaner( $row->fulltext ); $row->introtext = pdfCleaner( $row->introtext ); $pdf = new Cezpdf( 'a4', 'P' ); //A4 Portrait $pdf -> ezSetCmMargins( 2, 1.5, 1, 1); $pdf->selectFont( './fonts/Helvetica.afm' ); //choose font $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor( 0, 0, 0, 1 ); // footer $pdf->addText( 250, 822, 6, $mosConfig_sitename ); $pdf->line( 10, 40, 578, 40 ); $pdf->line( 10, 818, 578, 818 ); $pdf->addText( 30, 34, 6, $mosConfig_live_site ); $pdf->addText( 250, 34, 6, _PDF_POWERED ); $pdf->addText( 450, 34, 6, _PDF_GENERATED .' '. date( 'j F, Y, H:i', time() + $mosConfig_offset * 60 * 60 ) ); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject( $all, 'all' ); $pdf->ezSetDy( 30 ); $txt1 = $row->title; $pdf->ezText( $txt1, 14 ); $txt2 = AuthorDateLine( $row, $params ); $pdf->ezText( $txt2, 8 ); $txt3 = $row->introtext ."\n". $row->fulltext; $pdf->ezText( $txt3, 10 ); $pdf->ezStream(); } function decodeHTML( $string ) { $string = strtr( $string, array_flip(get_html_translation_table( HTML_ENTITIES ) ) ); $string = preg_replace( "/([0-9]+);/me", "chr('\\1')", $string ); return $string; } function get_php_setting ($val ) { $r = ( ini_get( $val ) == '1' ? 1 : 0 ); return $r ? 'ON' : 'OFF'; } function pdfCleaner( $text ) { // Ugly but needed to get rid of all the stuff the PDF class cant handle $text = str_replace( '
', "\n\n", $text ); $text = str_replace( '
', "\n\n", $text );
$text = str_replace( '
', "\n", $text );
$text = str_replace( '
', "\n", $text );
$text = str_replace( '
', "\n", $text );
$text = str_replace( '
', "\n", $text );
$text = str_replace( '