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:
- Download and install libraries module.
- Download TCPDF library from http://sourceforge.net/projects/tcpdf/files/
- Extract it to sites/all/modules/libraries.
- Download and install TCPDF module.
- Check the status report to verify if the installation was successful.
- 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/
精彩评论