Web Hosting Talk







View Full Version : [PDF Files]


JustinSmall
08-25-2008, 10:25 AM
Alright, creating PDF files on the fly :)

I ran into a little problem...

Fatal error: Class 'PDFlib' not found in /home/icandyde/public_html/pdftest.php



My code is:

<?php
$pdf = pdf_new();

pdf_open_file($pdf, "newpdf.pdf");

pdf_set_info($pdf, "Author", "Justin Small");
pdf_set_info($pdf, "Title", "Testing PDF Creation");
pdf_set_info($pdf, "Creator", "Justin Small");
pdf_set_info($pdf, "Subject", "Testing the creation of a PDF file");

pdf_begin_page($pdf, 612, 1008);

$arial = pdf_findfont($pdf, "Arial", "host", 1);
pdf_setfont($pdf, $arial, 14);

pdf_show_xy($pdf, "This is my PDF test, I hope this works!",50, 400);

pdf_end_page($pdf);
pdf_close($pdf);

echo "<A HREF=\"newpdf.pdf\" TARGET=\"_blank\">Open pdf in a new window $user</A>"
?>

So I figured, lets do a phpinfo(); check :)

Wallah, found nothing about PDF in phpinfo();

Very frustrating!

So now I have to install phplib right???

or is there any easier way going about creating pdf files on the fly???

Thanks for your responses.

JustinSmall
08-25-2008, 10:39 AM
I found FPDF...

When reading on the FPDF site, it said that is very common for the php.ini page to comment out the PDF section. That means anyone who uses my script would have to have access to the php.ini

So I'm going to try this FPDF I think, anyone know/have any problems with it?

JustinSmall
08-25-2008, 10:47 PM
http://icandydesigns.net/pdftest.php

This is what I ended up creating with FPDF (free pdf)...

pretty nifty, I will get better as I go with it. :) it's pretty nice right now though I think :)

:( no one messaged earlier though :'(