简体   繁体   English

PHP-tcpdf和wamp服务器

[英]PHP - tcpdf and wamp server

I'm having really a hard time with TCPDF, in what I am seeing from my searching here in Stack Overflow, I can't find any help in understanding on how to use TCPDF. 我在使用TCPDF时确实很难受,从我在Stack Overflow的搜索中可以看到,在理解如何使用TCPDF方面找不到任何帮助。 I can't figure out on how to include tcpdf in my website unlike FPDF, I'll just have to copy paste required folders and files inside the folder of the website then place a require(fpdf.php); 与FPDF不同,我不知道如何在网站中包含tcpdf,我只需要在网站文件夹中复制粘贴所需的文件夹和文件,然后放置require(fpdf.php); in the pages. 在页面中。 How do I do that in TCPDF? 如何在TCPDF中做到这一点?

I can't even figure out how to connect to my database unlike FPDF. 与FPDF不同,我什至不知道如何连接到我的数据库。

I want to know the basics in understanding TCPDF. 我想了解理解TCPDF的基础知识。

Can someone guide me in understanding TCPDF? 有人可以指导我理解TCPDF吗?

I have used this DOMPDF tutorial to convert my HTML file into PDF. 我已使用此DOMPDF教程将HTML文件转换为PDF。 You can send this PDF file to user mail also. 您也可以将此PDF文件发送到用户邮件。 It is very easy to understand. 这很容易理解。 Try this and please let me know whether it help you or not. 试试这个,请让我知道它是否对您有帮助。 You can see demo here 你可以在这里看到演示

EDIT :- If you don't want to send a mail then just remove the following code from form.php 编辑:-如果您不想发送邮件,则只需从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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM