html - DOMPDF not working -
i trying take html textarea
, convert pdf. donwnloaded dompdf https://github.com/dompdf/dompdf , wrote code below. when click submit error: "internal server error". (my webhost doesn't tell me line it's one) (the name of file 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>
i had similar issue on client's server when using dompdf project.
it's possible not have right level of error reporting configured installation of php.
at top of script place following; error_reporting(e_all);
example:
error_reporting(e_all); 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'); } }
you should see more detailed message type of error received.
there issues html markup passing $dompdf->load_html($content);
method or alternatively might experiencing memory related issues (exceeding memory allowance).
typically these errors report again depending on setup, reporting might limited.
Comments
Post a Comment