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

时间:2022-03-12 00:26:02

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.

我在Cakephp框架中开发一个网站,我想做的是给用户选择下载他正在以pdf格式查看的页面。我正在使用html2pdf插件,但它给出了与Cakephp集成的问题。我该怎么解决这个问题。 Thanx为您的利益。

3 个解决方案

#1


2  

Try TCPDF. It is simple and powerful enough.

试试TCPDF。它简单而有力。

#2


1  

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

我建议从FPDF开始,然后学习/移动到PDFLib

#3


1  

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");
?>

#1


2  

Try TCPDF. It is simple and powerful enough.

试试TCPDF。它简单而有力。

#2


1  

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

我建议从FPDF开始,然后学习/移动到PDFLib

#3


1  

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");
?>