You are here: PHP upgrade and PDFs « All PHP « IT news, forums, messages
PHP upgrade and PDFs

Posted by Pasquale on 09/28/87 11:42

With my host upgrading their PHP version to 4.4.2. I had to put the
filename parameter in the pdf_open_file(). In doing so, the PDF does not
come up for download now.

Can someone please let me know what I need to do with the last few lines
or so to get it to work?

Thanks.


<?php
$pdf = pdf_new();
pdf_open_file($pdf, "pdfs/pdftest3.pdf");
pdf_set_info($pdf, "author", "Pasquale");
pdf_set_info($pdf, "title", "Test for PHP PDF");
pdf_set_info($pdf, "subject", "Testing");
pdf_begin_page($pdf, 400, 500);
$font = pdf_findfont($pdf, "Helvetica-Bold", "winansi",0);
pdf_setfont($pdf, $font, 10);
pdf_show_xy($pdf, "This is a test.", 5, 300);
pdf_end_page($pdf);
pdf_close($pdf);
$buffer = pdf_get_buffer($pdf);

header( "Content-type: application/pdf" );
header("Content-Length: ".strlen($buffer));
header( "Content-Disposition: attachment; filename=pdfs/pdftest3.pdf" );

echo $buffer;
pdf_delete($pdf);
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация