php to pdf | Newbie | | Join Date: Nov 2008
Posts: 28
| |
hello,
i am trying to achieve a php to pdf simple example with PDFlib (bounded with php) but i get the error : - Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\_PHP\php_pdf\index.php:1) in C:\xampp\htdocs\_PHP\php_pdf\index.php on line 14
-
-
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\_PHP\php_pdf\index.php:1) in C:\xampp\htdocs\_PHP\php_pdf\index.php on line 15
-
-
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\_PHP\php_pdf\index.php:1) in C:\xampp\htdocs\_PHP\php_pdf\index.php on line 16
-
%PDF-1.4 %���� 3 0 obj <> stream x�s ��w3P04PI�2T0
-
the code is: - <?php
-
$mypdf = PDF_new();
-
PDF_open_file($mypdf, "");
-
PDF_begin_page($mypdf, 595, 842);
-
$myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
-
PDF_setfont($mypdf, $myfont, 10);
-
PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750);
-
PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);
-
PDF_end_page($mypdf);
-
PDF_close($mypdf);
-
-
$mybuf = PDF_get_buffer($mypdf);
-
$mylen = strlen($mybuf);
-
header("Content-type: application/pdf");
-
header("Content-Length: $mylen");
-
header("Content-Disposition: inline; filename=gen01.pdf");
-
print $mybuf;
-
-
PDF_delete($mypdf);
-
?>
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
-
<head>
-
<title></title>
-
-
</head>
-
-
<body>
-
-
</body>
-
-
</html>
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,936
| | | re: php to pdf
Hey, Arty.
Please see this thread (note the BOM part).
Mark.
| | Newbie | | Join Date: Nov 2008
Posts: 28
| | | re: php to pdf
hi,
i found a solution, i just changed my file from UTF to ANSI an d now it works.
do you know how can i make table cell looking with php to pdf ?
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,936
| | | re: php to pdf Quote:
Originally Posted by arty hi,
i found a solution, i just changed my file from UTF to ANSI an d now it works.
do you know how can i make table cell looking with php to pdf ? A table cell looking with php to pdf? I don't understand the question.
P.S. It was the BOM then.
| | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|