Hi!
I lost a lot of time trying to get dompdf and oder open source pdf libraries working. Unfortunately none was working. Especially floating images and positioning of elements did not work or was not supported.
After a research I found a brilliant PDF library that supports almost all css properies. Also floating of images.
http://www.princexml.com/download/
I tested the output on Windows and made an implementation for the print moudule. Attached you can find a patch that enables you to generate pdf using the non-commercial / commercial version of Prince XML:
Attached you finde the install instructions:
princexml support:
1. Download princexml from
http://www.princexml.com/download/
2. Install the prince executable on your server.
Note: If you are using windows, don't install prince in a folder with spaces, it
won't work, use "C:\Prince\" instead. If you have safe_mode enabled, place the
binary in the safe_mode binary folder.
3. Download php wrapper class from
http://www.princexml.com/download/accessories/
4. Copy prince.php to sites/all/modules/print/lib/prince or sites/all/libraries
5. Set the path to the binary int the PDF settings
6. All settings to the pdf output can be made via CSS Style sheet. See f.ex.
http://www.princexml.com/doc/7.0/page-size/
Attached you can find my patch against the dev version.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | print_6x.1.11-dev_100814_princexml_support.patch | 4.69 KB | ayalon |
| print_6x.1.x-dev_princexml_support.patch | 4.4 KB | ayalon |
Comments
Comment #1
jcnventuraYou can also try wkhtmltopdf which I believe works in the same way as Prince, but which is free.
At the moment, I would prefer to not add support to a non-open-source package, as I am not sure what that would do to the license of the module (probably nothing).
I will leave the patch here in the issue queue so that it is easily findable.
João
Comment #2
ayalon commentedPlease think about PrinceXML support. I'm not associated with the company and there is a free version of this tool also which adds only a small logo on the pdf. Mabye other user would be very happy with the free version because Images AND CSS are rendered perfectly.
Comment #3
ayalon commentedMaybe you can try it out if you have a small timeslot? Its really amazing.
Comment #4
ayalon commentedAttached you find a patch for the most current stable version.
Comment #5
awdlewis commentedHi,
I would really like to try this out. I have installed the Prince application on my server but now just need to figure out how to set the path to the binary from the Drupal site. How do I go about this? Do I need to create a symlink in order to do this?
Comment #6
ayalon commentedIf you apply the patch, there is a new option field on the pdf print module configuration under
admin/settings/print/pdf/options
called "Path of the prince binary:"
Quite obvious.. :-)
Comment #7
PhenX commentedI confirm that PrinceXML is a wonderful product (and I'm a DOMPDF developer).
There is a PHP connector in this page :
http://www.princexml.com/download/accessories/
It may make the work easier for this plugin.
Comment #8
ayalon commentedPhenX:
I already made a complete integration using the library you posted. Apply the patch and read the updated INSTALL.TXT.
By the way: This solutions works also on Windows Server. The seems to me the only working PDF solution, that really rocks on Windows too.
Comment #9
jcnventuraFeel free to use patch this into your module.. I need to create a pluggable-PDF-library-of-the-week system so that the task of maintaining these can be handled by a sub-module author.
Once I have that, I'll evaluate this, and decide whether it should be part of the print package or not.
Comment #10
jcnventuraMoved these requests into a catch-all issue: #1591718: Add support for other PDF libraries