How to use html2pdf to print html pages [closed]
I am using html2pdf
library in order to generate pdf from html file.
I don't know how to check o开发者_运维知识库ut width arrangements.
I had this library from source forge. If anyone has idea about it or manual about html2pdf
?
I think what you are asking is how to change the page width of the outputted PDF file. The answer is to change the width in the settings before you call AddPage(). Here is an example of how to do so: Here are the settings you will need: Basically, it would look something like this:
require("html2fpdf.php");
$htmlFile = "http://www.cnn.com";
$buffer = file_get_contents($htmlFile);
$pdf = new HTML2FPDF('P', 'mm', 'Legal');
$pdf->AddPage();
$pdf->WriteHTML($buffer);
$pdf->Output('my.pdf', 'F');
This, if I am getting the code right, would output a PDF called my.pdf that is formatted as a legal-size page in portrait mode.
精彩评论