2013-06-01 180 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