FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Extension Won't Install
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
ALternative? wkhtmltopdf. WAS: PHP Extension Won't Install [message #174308 is a reply to message #174291] Thu, 02 June 2011 08:58 Go to previous messageGo to previous message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma:
Senior Member
On 5/31/2011 3:45 PM, Don_ wrote:
> I successfully installed PEAR& PECL on my Windows Apache/XAMPP server. I
> am trying to install the PECL FPDF extension (for PDF Forms Data Format
> functions).
>
> At my command prompt window, I entered: "pecl list-all" and saw an entry
> named "pecl/fpdf" which is "PDF Form Data Format functions". So far so good!
>
> At my command prompt window, I unsuccessfully tried to install this
> extension using the following 3 commands.
>
> 1. pecl install pecl/fpdf
> Above resulted in "No release available for package 'pecl.php.net/fpdf'
> Install failed"
>
> 2. pecl install www.php.net/fpdf
> Above resulted in "Attempting to discover channel www.php.net ... invalid
> package name... install failed.
>
> 3. pecl install pecl.php.net/package/fpdf
> Above resulted in: "Attempting to discover channel pecl.php.net/package...
> downloading channel.xml... ... done: 3877bytes.
> unknown channel ... invalid package name .... install
> failed."
>
> Can anyone tell me what I am doing wrong in my attempt to use the PECL
> command to install the fpdf extension?
>
>

Hi Don,

I don't know what it is you want to do with pdf, but I would like to
advocate a package I have been working with lately.
It is called wkhtmltopdf.
http://code.google.com/p/wkhtmltopdf/

It focusses on generating PDF documents based on HTML.
You DO need to install webkit libs on your server first.

But it works like a charm.
I stopped generating PDFs by hand, which was, well, nothing for me
anyway. ;-)
Now I generate an HTML page that looks EXCATLY how I want it to look,
and then make a PDF of it.

My current code looks like this:
=========================================================
// Where to fetch it?
$url = "http://www.example.com/yourscript.php?id=23;
$fileName = "mypdf.pdf";
$targetName = "srv/hosting/whatever/www/temp_pdf/$fileName";

$cmd = "wkhtmltopdf -O Portrait -s A4 ".escapeshellarg($url);
$cmd .= " ".escapeshellarg($targetName);

// generate the pdf
$res = exec($cmd);
=========================================================

That way I can do what I am good at (HTML) and make PDFs.
I have been trying many many other html -> pdf generators and all fail
somehow, eg no css support, poor css support, poor table support, etc.

But since wkhtmltopdf is based on webkit, it handles it all.
wkhtmltopdf even runs javascript that generates/modifies DOM elements!

Not sure if it is something for you, but it saved me a lot of troubles.
And no, I didn't author the package or something. ;-)

Regards,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ANN: PDFTron PDF Library for PHP
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 01:28:06 GMT 2024

Total time taken to generate the page: 0.04617 seconds