开发者

How to use html2pdf to print html pages [closed]

开发者 https://www.devze.com 2023-03-09 21:22 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消