Web Hosting Talk







View Full Version : Printing Using PHP and PDF


jtrovato
08-30-2002, 09:55 AM
Has anybody does this? I want to make full dynamic documents for printing and saving that can be any number of pages.

John

Rich2k
08-30-2002, 10:01 AM
you can but you need to have the PDF modules of PHP installed first http://www.php.net/manual/en/ref.pdf.php

jtrovato
08-30-2002, 10:16 AM
Thanks Buddy. I'm checking that out now. have you done work this these functions? are they quick? any problems?

I'm assuming that all computers must have adobe on it..

John

Rich2k
08-30-2002, 11:45 AM
Not all, but I would think the majority of web enabled ones. Always include the link to Acrobat download to be safe though.

I've never needed to use them yet. Webmonkey tend to have quite good tutorials.
http://hotwired.lycos.com/webmonkey/02/20/index3a.html?tw=programming

Fish_Saver
09-02-2002, 01:35 PM
This seems to work with little effort


http://ros.co.nz/pdf/

jtrovato
09-02-2002, 03:00 PM
I went and set this up I tried the following code to see how it works

<?php
include ('class.ezpdf.php');
$pdf =& new Cezpdf();
$pdf->selectFont('./fonts/Helvetica.afm');
$pdf->ezText('Mary is Beautiful!',50);
$pdf->ezStream();
?>


I get TONS of errors ie.

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 808

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 811

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 813

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 816

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 824

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 831

Notice: Uninitialized string offset: 0 in d:\dj\newyorkfunfactory\pdf\class.ezpdf.php on line 833

Warning: Cannot add header information - headers already sent by (output started at d:\dj\newyorkfunfactory\pdf\class.ezpdf.php:808) in d:\dj\newyorkfunfactory\pdf\class.pdf.php on line 1605

Warning: Cannot add header information - headers already sent by (output started at d:\dj\newyorkfunfactory\pdf\class.ezpdf.php:808) in d:\dj\newyorkfunfactory\pdf\class.pdf.php on line 1606

Warning: Cannot add header information - headers already sent by (output started at d:\dj\newyorkfunfactory\pdf\class.ezpdf.php:808) in d:\dj\newyorkfunfactory\pdf\class.pdf.php on line 1608
%PDF-1.3 %âãÏÓ 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R >> >> /MediaBox [0 0 595.4 842] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (R and OS php pdf writer, http://www.ros.co.nz) /CreationDate (D:20020902) >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Length 61 >> stream BT 30.000 754.200 Td /F1 50.0 Tf (Mary is Beautiful!) Tj ET endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj xref 0 9 0000000000 65535 f 0000000015 00000 n 0000000080 00000 n 0000000126 00000 n 0000000266 00000 n 0000000295 00000 n 0000000400 00000 n 0000000463 00000 n 0000000575 00000 n trailer << /Size 9 /Root 1 0 R /Info 5 0 R >> startxref 682 %%EOF



SO I don't know where to go with this?? You probably know more than I do about this.

PHP Version 4.2.1
Windows 2000 Service Pack 3
MySQL 3.23.39
Apache 1.3.20

John

Fish_Saver
09-02-2002, 04:00 PM
Looks like at 810 in the code is where it starts setting margins.

$pdf -> ezSetMargins(30,30,30,30);

May get rid of it I am not sure.

I use the regular class.pdf.php.

I am not using the beta on his site .9 I am using .8

I am using http://telia.dl.sourceforge.net/sourceforge/pdf-php/pdfClassesAndFonts_008.zip

jtrovato
09-02-2002, 04:29 PM
I got it work. It only works on the linux server not the windows server. Do you have any exprience with windows??

john

Fish_Saver
09-02-2002, 06:46 PM
I used the class.pdf.php on a windows 2000 box today.


More experience with winders than I care for.

jtrovato
09-04-2002, 07:18 PM
Would you know the headers I would have to include in order for it to work?? can you give me a sample code.. The windows is only for testing and up load to a linux box....

Thanks for your help

John

dommymedia
09-07-2002, 02:50 AM
I've been using FPDF with great results (PDF reports generated by database query results):

http://www.fpdf.org/

jtrovato
09-07-2002, 10:00 AM
Thnaks This looks like what I need

John