Na wstępnie krótka charakterystyka.
Serwer lokalny. Serwer HTTP: Apache/2.2.6 (Win32) PHP/5.2.5
Bez wczytywania pliku html:
Kod
<?php
require_once("dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Hello World!</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("hello_world.pdf");
?>
require_once("dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Hello World!</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("hello_world.pdf");
?>
Rezultat:
Error logi na servie brak.
FF wyświetla:
Przerwane połączenie
Połączenie z serwerem zostało zresetowane podczas
Połączenie sieciowe zostało przerwane podczas negocjacji. Spróbuj ponownie.
Z wczytaniem pliku onas.html
Plik onas.html
Kod
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</head>
<body>
<P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="5" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Enter text into the <B>RichTextEditor control</B>, then click a <FONT COLOR="#0050AA"><B>button</B></FONT> to display your text as <I>plain text</I>, or as <I>HTML-formatted</I> text.</FONT></P>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</head>
<body>
<P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="5" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Enter text into the <B>RichTextEditor control</B>, then click a <FONT COLOR="#0050AA"><B>button</B></FONT> to display your text as <I>plain text</I>, or as <I>HTML-formatted</I> text.</FONT></P>
</body>
</html>
Skrypt:
Kod
<?php
require_once("dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Hello World!</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html("http://localhost/dpdf/onas.html");
$dompdf->render();
$dompdf->stream("hello_world.pdf");
?>
require_once("dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Hello World!</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html("http://localhost/dpdf/onas.html");
$dompdf->render();
$dompdf->stream("hello_world.pdf");
?>
Rezultat taki sam.
Plik dompdf_config.inc.php jest w tym samym folderze co skrypt.
Mam tylko obawy co do jednego i tu może tkwić problem. Wyczytałem gdzieś że ten plik czasami trzeba skonfigurować. A dokładniej linijkę:
113. define("DOMPDF_PDF_BACKEND", "auto");
Jeżeli ktoś używal tego to czy mógłby spojrzeć ewentualnie przypomnieć sobie co tam miał wpisane?