gpt4 book ai didi

php - pdf 下载 html2pdf

转载 作者:行者123 更新时间:2023-12-02 05:23:41 24 4
gpt4 key购买 nike

我正在使用 html2pdf 类生成 pdf。在我的问题中,它为 html 代码生成 pdf,但它没有提供下载该 pdf 的对话框选项。请帮助我的类(class)。

<?php
ob_start();
include(dirname(__FILE__).'/res/pdf_demo.php');
$content = ob_get_clean();

// conversion HTML => PDF
require_once(dirname(__FILE__).'/../html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('P','A4', 'fr', false, 'ISO-8859-15');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('pdf_demo.pdf');
}
catch(HTML2PDF_exception $e) { echo $e; }
?>

最佳答案

来自文档,方法输出

    /**
* Send the document to a given destination: string, local file or browser.
* Dest can be :
* I : send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
* D : send to the browser and force a file download with the name given by name.
* F : save to a local server file with the name given by name.
* S : return the document as a string. name is ignored.
* FI: equivalent to F + I option
* FD: equivalent to F + D option
* true => I
* false => S
*

关于php - pdf 下载 html2pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3870006/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com