View Full Version : PDFLIb and Perl
DaleE
08-21-2008, 10:33 AM
I've just moved over to BlueHost and have migrated all of my sites but I have a pdflib problem. I use an old version of pdflib (using the Perl bindings) which requires the standard ./configure, make, make test, make install compile proceedure. Given the access restrictions on the shared box there was no way this was going to work without some serious workarounds... and so far I'm not cracking it. I'm wondering if there are any experts on the board who can work with me to try and come up with a way of making this work. Of course, about 3 minutes of root access would solve my problem but I'm sure that BH isn't going to allow that. ;) So if there is anyone out there willing to wrestle with this thing on my behalf I would be grateful. TIA. Dale
DaleE
08-22-2008, 07:45 AM
Okay, so I figured this out and for the benefit of those who may want to tread this same path I will post my solution. It may open the door for using pdflib in php as well if you are stuck with that.
My Objective: To enable pdflib support for my perl based sites. My site generates a large variety of pdf files from data in mysql tables. The perl call use pdflib_pl; in my scripts is used to load the pdf library.
The Problem: To install pdflib requires the install process to write files to various places in the file system which BH users do not have access to.
Requirements: You've got to have shell access, nerves of steel, and some command line experience.
Caveats: PDFLib is commercial software and you need to pay for it unless you're using the Lite version. Free or purchased, you'll have to go through these steps to install it at BH. Also, these steps are for installing an old version of pdflib (4.0.3) so your mileage may vary if you are trying with a different version.
Steps:
1. Create a folder location for uploading and storing the finished compile. Something like /home/mysite/usr/
2. Upload the pdflib_x.x.x.tar.gz into /home/mysite/usr/ using whatever tool you use
3. cd to /home/mysite/usr/ and run
tar xvzf pdflib*
4. rename the created pdflib_x.x.x folder to pdflib (this is optional but saves some typing later)
5. cd to the pdflib folder
6. Run: ./configure --prefix=$HOME/usr
7. Run: make
8. In the shebang line of all of your perl scripts add:
-I/home/mysite/usr/pdflib/bind/perl/.libs
9. cd to /home/mysite/usr/pdflib/bind/perl and copy the file pdflib_pl.pm to the cgi-bin directory of your site and set the permissions to 755
10. Pour a cold glass of your favorite beverage and crank out the pdfs to your heart's content.
Regards,
Dale
dataman
08-23-2008, 05:28 AM
Dale,
If you're interested in going down the php path for pdf generation, I'd recommend that you checkout:
http://www.fpdf.org/
I've used this library extensively and it works quite well (assuming you're up to speed in php). You'll also be able to direct the output to specific directories within the $DOCUMENT_ROOT path.
DataMan
tameone
09-19-2008, 08:55 AM
Another great option for creating PDF's with PHP is TCPDF (www.tcpdf.org (http://www.tcpdf.org)), which was derived from FPDF in 2002. It's very popular and already being used in CMS's like Joomla. It does have a bit of a learning curve but considering the cost (free) and the advanced features, I think it's well worth the time to learn. I recently started using it to generate PDF invoices in PHP from my MySQL database. :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.