Php-> html a pdf (con htmldoc ) - URGENTE
Hola,
Tengo un problema neceisto sacar una pagina web directamente a pdf con el htmldoc. Pero he echo una de prueba y no hace nada:
<html>
<body>
<?
header("Content-Type: application/pdf");
header("Content-Disposition: attachment;filename="bulma.pdf"");
passthru("htmldoc --format pdf --left 2cm --right 1cm --top 1cm --bottom 1cm " .
"--headfootsize 9 --header 't l' --footer '/' " .
"--logoimage http://localhost/mail.gif " .
"--size 'a4' --fontsize 10 --charset 8859-15 " .
"--webpage http://chimera/prueba.html");
?>
</body>
</html>
Alguien sabe porque puede ser. Me da el siguiente error:
Warning: Cannot add header information - headers already sent by (output started at /srv/www/htdocs/imprimir.php:3) in /srv/www/htdocs/imprimir.php on line 15
Warning: Cannot add header information - headers already sent by (output started at /srv/www/htdocs/imprimir.php:3) in /srv/www/htdocs/imprimir.php on line 16
Gracias.
Manuel
Tengo un problema neceisto sacar una pagina web directamente a pdf con el htmldoc. Pero he echo una de prueba y no hace nada:
<html>
<body>
<?
header("Content-Type: application/pdf");
header("Content-Disposition: attachment;filename="bulma.pdf"");
passthru("htmldoc --format pdf --left 2cm --right 1cm --top 1cm --bottom 1cm " .
"--headfootsize 9 --header 't l' --footer '/' " .
"--logoimage http://localhost/mail.gif " .
"--size 'a4' --fontsize 10 --charset 8859-15 " .
"--webpage http://chimera/prueba.html");
?>
</body>
</html>
Alguien sabe porque puede ser. Me da el siguiente error:
Warning: Cannot add header information - headers already sent by (output started at /srv/www/htdocs/imprimir.php:3) in /srv/www/htdocs/imprimir.php on line 15
Warning: Cannot add header information - headers already sent by (output started at /srv/www/htdocs/imprimir.php:3) in /srv/www/htdocs/imprimir.php on line 16
Gracias.
Manuel
si vas a utilizar header, prueba sólo con las etiquetas de PHP:
<?
header("Content-Type: application/pdf");
header("Content-Disposition: attachment;filename="bulma.pdf"");
passthru("htmldoc --format pdf --left 2cm --right 1cm --top 1cm --bottom 1cm " .
"--headfootsize 9 --header 't l' --footer '/' " .
"--logoimage http://localhost/mail.gif " .
"--size 'a4' --fontsize 10 --charset 8859-15 " .
"--webpage http://chimera/prueba.html";);
?>
eso es lo único que debe contener el archivo, o bien checate
http://www.fpdf.org/
puedes descargar una libreria en PHP para crear pdf, hay varios ejemplos y el manual de referencia lo encuentras en español
<?
header("Content-Type: application/pdf");
header("Content-Disposition: attachment;filename="bulma.pdf"");
passthru("htmldoc --format pdf --left 2cm --right 1cm --top 1cm --bottom 1cm " .
"--headfootsize 9 --header 't l' --footer '/' " .
"--logoimage http://localhost/mail.gif " .
"--size 'a4' --fontsize 10 --charset 8859-15 " .
"--webpage http://chimera/prueba.html";);
?>
eso es lo único que debe contener el archivo, o bien checate
http://www.fpdf.org/
puedes descargar una libreria en PHP para crear pdf, hay varios ejemplos y el manual de referencia lo encuentras en español