将html网页转换为pdf页面(用户将下载的pdf文件)

I am developing a website in Cakephp framework, what i want to do, is to give the user option of downloading the page he is viewing in pdf format.I am using html2pdf plugin but its giving problem integrating with Cakephp. How can i solve this. Thanx for your interest.

Try TCPDF. It is simple and powerful enough.

Two options, one is paid and another open source. Both are good, and well documented.

  1. PDFLib
  2. FPDF

I would suggest starting with FPDF, and then learning/moving to PDFLib

Using DOMPDF.

Example Code :

<?php
    require_once("dompdf/dompdf_config.inc.php");

    $html = "<h1>some document</h1>";

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);  
    $dompdf->set_paper('A4');
    $dompdf->render();
    $dompdf->stream("pdfReport.pdf");
?>