I am trying to take some html from a textarea
and convert it to a pdf. I donwnloaded DOMPDF from https://github.com/dompdf/dompdf and wrote the code below. When I click submit I get this error: "Internal Server Error". (my webhost doesn't tell me which line it's one)
(the name of this file is test2.php)
<?php
if (isset($_POST['submit'])) {
$content = $_POST['content'];
if (empty($content)){
$error = 'write something';
}
else {
include_once( 'dompdf/dompdf_config.inc.php' );
$dompdf = new DOMPDF();
$dompdf->load_html($content);
$dompdf->render();
$dompdf->stream('example.pdf');
}
}
?>
<!DOCTYPE html>
<head>
</head>
<body>
<?php
if(isset($error)){
echo $error;
}
?>
<form method="post" action="test2.php">
<textarea name="content" id="content">hello world</textarea><br>
<input type="submit" name="submit" value='submit'>
</form>
</body>
</html>