我在使用 TCPDF 时真的很难,从我在 Stack Overflow 的搜索中看到的,我在理解如何使用 TCPDF 方面找不到任何帮助。与 FPDF 不同,我无法弄清楚如何在我的网站中包含 tcpdf,我只需将所需的文件夹和文件复制粘贴到网站的文件夹中,然后require(fpdf.php);
在页面中放置一个。我如何在 TCPDF 中做到这一点?
与 FPDF 不同,我什至无法弄清楚如何连接到我的数据库。
我想了解了解 TCPDF 的基础知识。
有人可以指导我理解 TCPDF 吗?
我已使用此DOMPDF教程将我的 HTML 文件转换为 PDF。您也可以将此 PDF 文件发送到用户邮箱。这很容易理解。试试这个,请让我知道它是否对你有帮助。你可以在这里看到演示
编辑:-如果您不想发送邮件,则只需从以下代码中删除form.php
// Load the SwiftMailer files
require_once($dir.'/swift/swift_required.php');
$mailer = new Swift_Mailer(new Swift_MailTransport()); // Create new instance of SwiftMailer
$message = Swift_Message::newInstance()
->setSubject('How To Create and Send An HTML Email w/ a PDF Attachment') // Message subject
->setTo(array($post->email => $post->name)) // Array of people to send to
->setFrom(array('no-reply@net.tutsplus.com' => 'Nettuts+')) // From:
->setBody($html_message, 'text/html') // Attach that HTML message from earlier
->attach(Swift_Attachment::newInstance($pdf_content, 'nettuts.pdf', 'application/pdf')); // Attach the generated PDF from earlier
// Send the email, and show user message
if ($mailer->send($message))
$success = true;
else
$error = true;