예제 #1
0
$image = $pdf->jfif_embed($data);
*/
/* Once the image is embedded in the PDF, it can be
 * placed as many or few times as you like.  This is a
 * very nice feature of PDFs, as it allows you to place
 * the same image at (for example) different scalings, thus
 * saving space in the file.
 * The first parameter is an ID for an image
 * The second is the bottom edge of the image (in PDF units)
 * The third is the left edge (in PDF units)
 * The fourth is the page ID to place the image on
 * The fifth is a parameters array that can specify rotation
 * and scaling
 * Here are several example of image placement
 */
$pdf->image_place($image, 200, 300, $firstpage);
$pdf->image_place($image, 300, 300, $firstpage, array('scale' => 10, 'rotation' => 30));
$pdf->image_place($image, 400, 300, $firstpage, array('scale' => 25, 'rotation' => 60));
/* A quick example for creating additional pages
 * and placing objects on them.
 */
$secondpage = $pdf->new_page("legal");
$pdf->draw_rectangle(998, 10, 10, 602, $secondpage);
$pdf->draw_text(300, 450, "Page #2", $secondpage);
$pdf->draw_text(300, 400, "backslashes (\\) cause no problems", $secondpage);
/* Circle command is new to 2.1
 */
$pdf->draw_circle(150, 200, 50, $secondpage, array('mode' => 'stroke', 'strokecolor' => $pdf->get_color('blue'), 'width' => 5));
$pdf->draw_circle(300, 200, 35, $secondpage, array('mode' => 'fill'));
$pdf->draw_circle(450, 200, 50, $secondpage, array('mode' => 'fill+stroke', 'fillcolor' => $pdf->get_color('red')));
/* Uses the absolute page size notation to create
예제 #2
0
*/
/* The intent of this file is to show off just what
 * can be done with phppdflib
 */
require '../phppdflib.class.php';
$pdf = new pdffile();
$pdf->set_default('margin', 0);
$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;