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

Home » FUDforum » FUDforum Suggestions » PDF
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
icon3.gif  PDF [message #21319] Thu, 25 November 2004 03:39 Go to next message
rwest is currently offline  rwest   United States
Messages: 24
Registered: March 2002
Karma: 0
Junior Member
Since libpdf is a commercial product with an iffy license, why not try to utilize something like FPDF (http://www.fpdf.org)?

FPDF, or Free PDF, is a class that generates pure PDF files. It's pretty easy to implement.. it's just difficult to get the formatting the way you want it to (similar with libpdf).

That way you could have PDF support without the restrictions of libpdf and the PHP compilation requirements. Because fpdf is a class library, it's just like any other piece of PHP code.

Anyhow, it is just a thought..

[Updated on: Thu, 25 November 2004 03:40]

Report message to a moderator

Re: PDF [message #21328 is a reply to message #21319] Thu, 25 November 2004 13:59 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Good question Smile

Generating PDF is already a fairly slow process even when a PHP extension is used. Using a PHP class (much much slower) would only worsen the process and make this impractical on any significant scale.


FUDforum Core Developer
Re: PDF [message #21331 is a reply to message #21328] Thu, 25 November 2004 16:20 Go to previous messageGo to next message
Anonymous   United States
I'm not sure if I agree that it would make it impractical. The PDF functionality (I've worked with both libpdf and fpdf class lib) never seemed to be a slow process in either case..

Sure, if one were to run FudForum on a very old and slow machine, yes it would be too slow to utilize since any PDF generation is horribly slow because it is a CPU intensive task.

For a very small project of my own, I tried out implementing the fpdf class, and I was surprised to see that, not only was it easy to implement (but somewhat of a pain to get the grid lines where you want them), it was rather robust.

The performance hit that a PDF class lib has is when it needs to generate a rather complex page, and the resulting pages from FudForum are straightforward, clean, and, generally not complex. :) (one of the things I like about FudForum as a whole!)

Anyhow, it was just a thought.. I didn't know if anyone had ever considered it...

Thanks for the response!

Ilia wrote on Thu, 25 November 2004 08:59

Good question :)

Generating PDF is already a fairly slow process even when a PHP extension is used. Using a PHP class (much much slower) would only worsen the process and make this impractical on any significant scale.

Re: PDF [message #21335 is a reply to message #21331] Thu, 25 November 2004 17:26 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Most users of the forum don't have their own servers and share "their" servers with dozens of other users. This means that even if the server is fairly powerful amount of resources available to each user is still rather limited.

The FPDF library of scripts maybe fine (speed wise) for making a PDF of a small topic, however if you try to make a PDF of an entire forum or a long topic the performance hit of using PHP to make a PDF will be quite noticeable. People who are more familiar with it tell me that for complex documents the performance drop is more then 10x.



FUDforum Core Developer
Re: PDF [message #21336 is a reply to message #21335] Thu, 25 November 2004 19:51 Go to previous messageGo to next message
rwest is currently offline  rwest   United States
Messages: 24
Registered: March 2002
Karma: 0
Junior Member
Ah.. ok.. that's more like it. Smile

(just as an FYI, I, too, am on a shared server)

It could be a viable alternative to libpdf when it is unavailable by the service provider...
Re: PDF [message #21337 is a reply to message #21336] Thu, 25 November 2004 20:04 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Another issue is that to enable this functionality FUDforum would need to bundle the library which is ~ 150kb in the distribution. This a fair chunk of code to include...

FUDforum Core Developer
Re: PDF [message #21346 is a reply to message #21337] Fri, 26 November 2004 03:00 Go to previous messageGo to next message
rwest is currently offline  rwest   United States
Messages: 24
Registered: March 2002
Karma: 0
Junior Member
Naaah.. That's only if you include all of the examples and stuff.

If you strip it down to just the class itself and maybe a simple font, you're only looking at like:
#/lib/fpdf152> ls -l
total 52
drwxr-xr-x 3 root root 4096 Nov 10 14:21 font/
-rwxr-xr-x 1 root root 504 Nov 10 14:21 fpdf.css*
-rwxr-xr-x 1 root root 41478 Nov 10 14:21 fpdf.php*

Which really isn't much. Smile
Re: PDF [message #21347 is a reply to message #21346] Fri, 26 November 2004 03:42 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
without examples it is 150k, the fonts directory is pretty big.

FUDforum Core Developer
Re: PDF [message #21350 is a reply to message #21347] Fri, 26 November 2004 04:01 Go to previous messageGo to next message
Anonymous   United States
The fonts directory is filled with a lot of extra stuff.. if you trim it down to one font (like helvetica.php), it's only a 4k file.

Anyhow, it's no problem.. you already answered my original question more than fully. I don't want to come across like I am trying to be a pain to try to get this implemented.. :) It was just a thought that crossed my mind and I thought I would ask.

Ilia wrote on Thu, 25 November 2004 22:42

without examples it is 150k, the fonts directory is pretty big.

Re: PDF [message #21351 is a reply to message #21350] Fri, 26 November 2004 04:01 Go to previous messageGo to next message
rwest is currently offline  rwest   United States
Messages: 24
Registered: March 2002
Karma: 0
Junior Member
Whoops.. forgot to log in. That last post was me. Smile
Re: PDF [message #21398 is a reply to message #21351] Mon, 29 November 2004 16:08 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
I've done a code review of FPDF and after quite a few tests managed to tune FPDF to give "agreeable" speeds for FUDforum and I was also able to trim bloat from the code to make it into a compact 29k library (including fonts).

Future versions will use this for PDF generation rather then relying on libPDF who's license seems to be getting worse and worse.


FUDforum Core Developer
Re: PDF [message #22197 is a reply to message #21319] Thu, 20 January 2005 04:19 Go to previous messageGo to next message
Anonymous   Thailand
xxx
Re: PDF [message #22198 is a reply to message #22197] Thu, 20 January 2005 04:24 Go to previous messageGo to next message
Anonymous   Thailand
xxx
icon6.gif  Re: PDF [message #22199 is a reply to message #22198] Thu, 20 January 2005 04:53 Go to previous message
Anonymous   Thailand
No Message Body
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: language selection at the registration
Next Topic: Showing today replies quantity
Goto Forum:
  

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

Current Time: Sat Nov 23 11:47:02 GMT 2024

Total time taken to generate the page: 0.02843 seconds