2013-06-01 163 views
1

我真的很难与TCPDF,我从我在堆栈溢出在这里搜索看到,我找不到任何帮助了解如何使用TCPDF。我不知道如何在我的网站中包含tcpdf,而不像FPDF,我只需要在网站的文件夹中复制粘贴所需的文件夹和文件,然后在页面中放置一个require(fpdf.php);。我如何在TCPDF中做到这一点?PHP-tcpdf和wamp服务器

我甚至不知道如何连接到我的数据库不像FPDF。

我想了解理解TCPDF的基础知识。

有人可以指导我理解TCPDF吗?

+0

删除下面的代码你想你的HTML文件转换成PDF? –

+0

是的...我试过的样品,但与MySQL查询它无法正常工作。我不知道如何... :( – reggel

回答

0

我已经使用这个DOMPDF教程将我的HTML文件转换为PDF。您也可以将此PDF文件发送给用户邮件。这很容易理解。试试这个,请让我知道它是否对你有帮助。你可以看到演示here

编辑: -如果您不想发送邮件,则刚刚从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('[email protected]' => '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; 
+0

确定确定tnx ...生病让你知道 – reggel

+0

好吧我今天在我的项目中试过这个,它根据我的要求完美地工作,如果你有任何问题,让我知道 –

+0

它的有用但我只想要一个人可以从一个表格中的数据库中查看数据在pdf文档中... – reggel