Finally, I found HTMLDoc. It's open source but to get the compiled-ready binary you need to buy.
Fortunately. I found the free compiled binary here :
http://htmldoc-binaries.org/
Download and install HTMLDoc.
public function topdf($filename, $options = "") {Just submit your URL / file name and the HTMdoc will will create the PDF on the fly.
$path = "library_includes/general/htmldoc/htmldoc.exe";
$path=realpath($path);
# Tell HTMLDOC not to run in CGI mode...
putenv("HTMLDOC_NOCGI=1");
$scmd = "$path -t pdf --quiet --landscape --jpeg --webpage --header ... $options $filename";
# Write the content type to the client...
header("Content-Type: application/pdf");
flush();
system($scmd);
}
For more details about the command line, you can refer be to the document :
http://www.easysw.com/htmldoc/docfiles/8-cmdref.html
But, if your url is password protected using login and session, you need to handle to bypass the session checking since HTMLDoc read the url and PHP will treat HTMLDoc as new session rather than your current.