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.

Comments

jcnventura’s picture

Status: Needs review » Postponed

You 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

ayalon’s picture

Status: Postponed » Needs review

Please 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.

ayalon’s picture

Maybe you can try it out if you have a small timeslot? Its really amazing.

ayalon’s picture

Version: 6.x-1.x-dev » 6.x-1.11
StatusFileSize
new4.69 KB

Attached you find a patch for the most current stable version.

awdlewis’s picture

Hi,
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?

ayalon’s picture

If 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.. :-)

PhenX’s picture

I 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.

ayalon’s picture

PhenX:

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.

jcnventura’s picture

Status: Needs review » Postponed

Feel 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.

jcnventura’s picture

Status: Postponed » Closed (duplicate)

Moved these requests into a catch-all issue: #1591718: Add support for other PDF libraries