Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>the question is kinda old, but this is how I solved the blank page from getHtmlFromPage method. Instead of using the getHtmlFromPage method, I simply used curl to get the page I want to pdf and then passed that to the html2pdf as a string an voila!</p> <pre><code>require_once 'path_to_html2pdf/html2pdf/html2pdf.class.php'; $str_url = 'http://your_url_here.php'; $str_content = get_page($str_url); //get_page can be file_get_contents if your server allows for that function to open a url or a curl function that im posting down below try{ $html2pdf = new HTML2PDF('P', 'A4', 'es'); $html2pdf-&gt;pdf-&gt;SetDisplayMode('fullpage'); $html2pdf-&gt;writeHTML($str_content ); $html2pdf-&gt;Output('your_file_name.pdf', 'D'); //The 'D' option downloads the pdf instead of just showing it on screen } catch(HTML2PDF_exception $e) { echo $e; exit; } //Here is the curl function for get_page function get_page($str_url){ if(strpos($str_url, 'http://') === false){ return file_get_contents($str_url); }else{ if(ini_get('allow_url_fopen')){ return file_get_contents($str_url); }else{ $curl = curl_init(); curl_setopt ($curl, CURLOPT_REFERER, strFOARD); curl_setopt ($curl, CURLOPT_URL, $str_url); curl_setopt ($curl, CURLOPT_TIMEOUT, 30); curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5))); curl_setopt ($curl, CURLOPT_HEADER, 0); curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); $html = curl_exec ($curl); curl_close ($curl); return $html; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload