开发者

How to create pdf files in drupal?

I want to create pdf files in drupal .module file.

I have view of bulk operations in which I have added an operation send pdf file and download pdf file. I want to get some data from the database and and create a pdf file from it and when I select an operations it should create and send the pdf file in an email.

So 开发者_高级运维how could I do this???


You should look first in the PHP library for creating PDF files. You can use TCPDF or many others in the PHP libraries: https://stackoverflow.com/questions/560583/which-is-the-best-pdf-library-for-php


After doing a quick search at Drupal Modules I found this module. And I also found this by Googling. The latter one seems to need no additional PHP modules and should be easy to integrate.


There is a new module named PHP WK HTML to PDF

From his site:

This is intended for module developers, nothing is usable from the front-end.

This module is a Drupal Library implementation for the PHPWkHtmlToPdf wrapper and as a result is extremely small because it uses WkHtmlToPdf to do the heavy work.

And you can use if you want Views PDF

With this module you can output a view as a PDF document. Each field of the view can be placed on the PDF page directly in the administration interface. Therefore a new display called "PDF" is added.


You should use the module print. This module allow you to print a node but also any page of your site. After enable the module you can generate pdf simply by visiting url starting with printpdf/NID or printpdf/AnyPAth.

To generate the pdf it can use the following libraries: dompdf, TCPDF, wkhtmltopdf.

Follow the installation guide


TCPDF is good for pdf creation.

There is new module TCPDF. See tcpdf_example submodule to get started.

For installation see INSTALL.txt:

  1. Download and install libraries module.
  2. Download TCPDF library from http://sourceforge.net/projects/tcpdf/files/
  3. Extract it to sites/all/modules/libraries.
  4. Download and install TCPDF module.
  5. Check the status report to verify if the installation was successful.
  6. Have fun.


I had a very intricately styled view recently that I just couldn't get looking the same as a pdf, I used this service to do it and I was pretty impressed. http://www.html2pdfrocket.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜