PDA

View Full Version : EZPDF - Formatting Woes


MrJL
10-20-2007, 03:09 AM
Ok, so I'm working with the ezpdf (http://www.ros.co.nz/pdf/) script to create a PDF document via PHP. Problem being, where most folks use PHP/PDF to create reports, I'm using it more to create a formatted document...A job application, to be precise.

Now, what I'm running into is a slight issue when it comes to printing on the page using different fonts on the same line. For instance...

Name: Name Goes Here Phone: Phone # Goes Here

EZPDF comes with two classes, one is for basic stuff, the other more complex. I could accomplish this task with the basic class, however...It didn't support word wrap which I would need for some areas of the application.

Soooo, the more complex class, it is and I have my code as follows:

include ('class.ezpdf.php');

$response = " John Doe";

$pdf =& new Cezpdf();
$pdf->selectFont('./fonts/Courier-Bold');
$pdf->ezText('Name:',18);
$pdf->ezSetDy(15);
$pdf->selectFont('./fonts/Times-Roman');
$pdf->ezText($response,14);
$pdf->ezStream();

Now, the problem I'm running into is that with this particular class I've not found a way to set the horizontal position of the cursor. So I've been forced to use the exSetDy(15) to move the cursor back up to the first line, and then the abundance of white space at the beginning of $response to space it out the position it needs to be.

The problem I run into is that...To be forced to do that for the entire application would be a nightmare.

Is anyone familiar with EZPDF and have any suggestions on an easier way to accomplish this? I've already tried to do this using PDFLib, and it isn't installed on my server. I actually had it all worked out how I would do it with that.

Just as an aside, the info will not be drawn from a DB, it will be processed as the indivial fills out the app on a form on the website. When they finish, it will be e-mailed.

GJay
10-20-2007, 09:51 AM
I've used ezpdf a bit, and it isn't particularly nice. I always made everything into tables, it seemed to be the easiest way to get things to line up, and applied different formatting to different cells.

MrJL
10-21-2007, 03:45 AM
I've used ezpdf a bit, and it isn't particularly nice. I always made everything into tables, it seemed to be the easiest way to get things to line up, and applied different formatting to different cells.

Is there a better (easier?) solution out there? I found EZPDF, basically, by doing a search and it seemed the most popular. But if you can recommend something that's easier to work with, I'd gladly use it. LoL