$nom_adh_ext .= _T("Society"); break; default: $nom_adh_ext .= ""; } $x1 = $xorigin + ($col - 1) * (round(PREF_ETIQ_HSIZE * 2.835) + round(PREF_ETIQ_HSPACE * 2.835)); $x2 = $x1 + round(PREF_ETIQ_HSIZE * 2.835); $y1 = $yorigin - ($row - 1) * (round(PREF_ETIQ_VSIZE * 2.835) + round(PREF_ETIQ_VSPACE * 2.835)); $y2 = $y1 - round(PREF_ETIQ_VSIZE * 2.835); $nom_adh_ext .= " " . strtoupper($resultat->fields[1]) . " " . ucfirst(strtolower($resultat->fields[2])); $concatname = $concatname . " - " . $nom_adh_ext; $param["font"] = "Helvetica-Bold"; $pdf->draw_paragraph($y1 - 10, $x1, $y1 - 10 - round(PREF_ETIQ_VSIZE * 2.835) / 5 + 5, $x2, $nom_adh_ext, $firstpage, $param); $param["font"] = "Helvetica"; $pdf->draw_paragraph($y1 - 10 - round(PREF_ETIQ_VSIZE * 2.835) / 5, $x1, $y1 - 10 - round(PREF_ETIQ_VSIZE * 2.835) / 5 - round(PREF_ETIQ_VSIZE * 2.835) * 4 / 5, $x2, $resultat->fields[3] . "\n" . $resultat->fields[8] . "\n" . $resultat->fields[5] . " - " . $resultat->fields[6] . "\n" . $resultat->fields[7], $firstpage, $param); $pdf->draw_rectangle($y1, $x1, $y2, $x2, $firstpage, $param); $resultat->MoveNext(); $col++; if ($col > PREF_ETIQ_COLS) { $col = 1; $row++; } if ($row > PREF_ETIQ_ROWS) { $col = 1; $row = 1; $firstpage = $pdf->new_page("a4"); } $nb_etiq++; } $resultat->Close(); //dblog("Generation of "." ".$nb_etiq." "."label(s)",$concatname);
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: example-packer.php 221 2005-06-25 01:22:54Z deelight $ */ require '../phppdflib.class.php'; $pdf = new pdffile(); $pdf->enable('packer'); $page = $pdf->packer->new_page(); $pdf->set_default('smode', 'fill'); $pdf->set_default('fillcolor', $pdf->get_color('red')); $space = new field(100, 200, 100, 200); $pdf->packer->allocate($space); $pdf->draw_rectangle(200, 100, 100, 200, $page); $pdf->set_default('fillcolor', $pdf->get_color('blue')); $space = new field(150, 300, 150, 400); $pdf->packer->allocate($space); $pdf->draw_rectangle(400, 150, 150, 300, $page); $pdf->set_default('fillcolor', $pdf->get_color('green')); $space = new field(400, 600, 600, 800); $pdf->packer->allocate($space); $pdf->draw_rectangle(800, 400, 600, 600, $page); $pdf->set_default('fillcolor', $pdf->get_color('black')); $pdf->set_default('height', 10); $text = implode('', file('text.txt')); $pdf->packer->fill_text($text); $pdf->set_default('smode', 'stroke'); $pdf->set_default('strokecolor', $pdf->get_color('#cccccc')); foreach ($pdf->packer->fields as $f) {
// Alter some parameters and place more text $param["font"] = "Courier-Bold"; $param["mode"] = "fill+stroke"; $param["height"] = 32; $param["rotation"] = 0; $pdf->draw_text(10, 100, "This is red, Courier-Bold text", $firstpage, $param); /* By omitting the final parameter, we get the same * text placed with default text settings */ $pdf->draw_text(10, 150, "This is not red text", $firstpage); /* simply draws a rectange on the page. * Specify the top,left,bottom,right locations * (in that order) and the ID of the page to place * it on */ $pdf->draw_rectangle(30, 10, 10, 30, $firstpage); /* Lets draw a rectangle with some fancy parameters * First we'll set the color */ $param["red"] = 0; $param["green"] = 1; $param["blue"] = 0; /* Now we'll set the line width, this is in pdf units * (1/72 of an inch) */ $param["width"] = 5; /* Place a rectangle with these parameters */ $pdf->draw_rectangle(250, 200, 200, 250, $firstpage, $param); /* Add a preexisting image to the page * * Manually creating a bitmap image like this isn't terribly
$data = ""; for ($i = 100; $i != 255; $i++) { $data .= chr($i) . "ΓΏ" . chr($i); } $image = $pdf->image_raw_embed($data, "/DeviceRGB", 8, 1, 154); $firstpage = $pdf->new_page("letter"); $p['scale']["x"] = 612 / 154; $p['scale']["y"] = 792; $pdf->image_place($image, 0, 0, $firstpage, $p); $p['scale']["x"] = 300 / 154; $p['scale']["y"] = 150; $p['rotation'] = 270; $pdf->image_place($image, 690, 400, $firstpage, $p); $p['fillcolor'] = $pdf->get_color('white'); $p['mode'] = 'fill'; $pdf->draw_rectangle(792, 0, 792 - 75, 612, $firstpage, $p); $param["height"] = 32; $param["font"] = "Times-Bold"; $param["mode"] = "fill+stroke"; $param['fillcolor']["red"] = 0; $param['fillcolor']["blue"] = 0; $param['fillcolor']["green"] = 0.5; $param['strokecolor']["red"] = 0; $param['strokecolor']["blue"] = 0; $param['strokecolor']["green"] = 0; $pdf->draw_text(70, 680, "Dynamically generated PDF files", $firstpage, $param); $text = <<<EOT Dynamically generated PDF files can enhance your website by making it more interesting and useful to your target audience. Any time you want to deliver a print-ready document across the Internet, the PDF format is the correct delivery medium. Whether it be downloadable or emailed, a document in PDF format is virtually guaranteed to display and print properly on any computer. HTML can't promise this, and neither can proprietary formats, such as Word or Wordperfect documents. EOT; $pdf->draw_paragraph(660, 50, 300, 380, $text, $firstpage);