Page 1 of 1

phppdflib.class

Posted: Tue Jul 27, 2004 4:36 pm
by hward
can someoen help me with this. I have a script written using it and it pulls info from my database and displays it the way I want but I am not sure how to deal with multiple returns,

Posted: Tue Jul 27, 2004 4:51 pm
by kettle_drum

Code: Select all

$result = mysql_query("...."); //returns more than one row
while($row = mysql_fetch_assoc($result)){
   echo $row['field'];
}
Like that?

Posted: Tue Jul 27, 2004 5:00 pm
by hward

Code: Select all

<?php


require('../phppdflib.class.php');


$pdf = new pdffile;
$pdf->set_default('margin', 0);
$param["height"] = 12;
$param["font"] = "Times-Italic";

$firstpage = $pdf->new_page("5x3in");
$pdf->draw_rectangle( 198, 18, 18, 342, $firstpage, $param);
$pdf->draw_text(150, 100, "Page #1", $firstpage, $param);


$secondpage = $pdf->new_page("5x3in");
$pdf->draw_rectangle( 198, 18, 18, 342, $secondpage, $param);
$pdf->draw_text(150, 100, "Page #2", $secondpage, $param);


$thirdpage = $pdf->new_page("5x3in");
$pdf->draw_rectangle( 198, 18, 18, 342, $thirdpage, $param);
$pdf->draw_text(150, 100, "Page #3", $thirdpage, $param);


$fourthpage = $pdf->new_page("5x3in");
$pdf->draw_rectangle( 198, 18, 18, 342, $fourthpage, $param);
$pdf->draw_text(150, 100, "Page #4", $fourthpage, $param);


header("Content-Disposition: filename=example.pdf");
header("Content-Type: application/pdf");
$temp = $pdf->generate();
header('Content-Length: ' . strlen($temp));


echo $temp;


?>
ok this code generates a pdf file with four pages in it , you can see each page info in it. I want a script that can write that script with the same amout of pages in it that are returned from my sql

not sure if I am making any sense
not sure how to explain this

Posted: Tue Jul 27, 2004 5:07 pm
by hward
i know this is not ever close to anything being correct but maybe it will help explain what i am wanting to do







$result = @mysql_query($sql,$connection)
or die("Couldn't execute query.");

while ($row = mysql_fetch_array($result)) {
;
}

$display_block .= "
$page = $pdf->new_page("5x3in");
$pdf->draw_rectangle( 198, 18, 18, 342, $page, $param);
$pdf->draw_text(150, 100, "Page #?", $page, $param);
";

}

print(

<?php

require('../phppdflib.class.php');


$pdf = new pdffile;
$pdf->set_default('margin', 0);
$param["height"] = 12;
$param["font"] = "Times-Italic";

<? echo "$display_block"; ?>


header("Content-Disposition: filename=example.pdf");
header("Content-Type: application/pdf");
$temp = $pdf->generate();
header('Content-Length: ' . strlen($temp));


echo $temp;

?>

);