Ejemplo n.º 1
0
pdf_lineto($pdf, 121, -11);
pdf_moveto($pdf, 0, 121);
pdf_lineto($pdf, 0, 131);
pdf_moveto($pdf, 121, 121);
pdf_lineto($pdf, 121, 131);
pdf_moveto($pdf, -1, 0);
pdf_lineto($pdf, -11, 0);
pdf_moveto($pdf, -1, 120);
pdf_lineto($pdf, -11, 120);
pdf_moveto($pdf, 122, 0);
pdf_lineto($pdf, 132, 0);
pdf_moveto($pdf, 122, 120);
pdf_lineto($pdf, 132, 120);
pdf_stroke($pdf);
if ($bitmap['front_resolution'] >= $cfg['image_front_cover_treshold']) {
    $pdfdfimage = pdf_load_image($pdf, 'auto', $cfg['media_dir'] . $bitmap['image_front'], '');
    pdf_fit_image($pdf, $pdfdfimage, 0, 0, 'boxsize {121 120} position {50 50} fitmethod slice');
    $hash_data .= '-' . filesize($cfg['media_dir'] . $bitmap['image_front']) . '-' . filemtime($cfg['media_dir'] . $bitmap['image_front']);
}
//  +------------------------------------------------------------------------+
//  | Close and download PDF                                                 |
//  +------------------------------------------------------------------------+
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
pdf_delete($pdf);
$filename = $album['artist'] . ' - ' . $album['album'] . '.pdf';
$filename = downloadFilename($filename);
$etag = '"' . md5($hash_data) . '"';
streamData($data, 'application/pdf', 'inline', $filename, $etag);
updateCounter($album_id, NJB_COUNTER_COVER);
 pdf_show_xy($pdf, 'This is to certify that:', $startx, 430);
 pdf_show_xy($pdf, strtoupper($name), $startx + 90, 391);
 $font = pdf_findfont($pdf, $fontname, 'host', 0);
 if ($font) {
     pdf_setfont($pdf, $font, 20);
 }
 pdf_show_xy($pdf, 'has demonstrated that they are certifiable ' . 'by passing a rigorous exam', $startx, 340);
 pdf_show_xy($pdf, 'consisting of three multiple choice questions.', $startx, 310);
 pdf_show_xy($pdf, "{$name} obtained a score of {$score}" . '%.', $startx, 260);
 pdf_show_xy($pdf, 'The test was set and overseen by the ', $startx, 210);
 pdf_show_xy($pdf, 'Fictional Institute of PHP Certification', $startx, 180);
 pdf_show_xy($pdf, "on {$date}.", $startx, 150);
 pdf_show_xy($pdf, 'Authorised by:', $startx, 100);
 // add bitmap signature image
 $signature = pdf_load_image($pdf, 'png', '/Program Files/Apache Software Foundation/Apache2.2/htdocs/phpmysql4e/chapter33/signature.png', '');
 pdf_fit_image($pdf, $signature, 200, 75, '');
 pdf_close_image($pdf, $signature);
 // set up colors for ribbon
 pdf_setcolor($pdf, 'fill', 'rgb', 0, 0, 0.4, 0);
 // dark blue
 pdf_setcolor($pdf, 'stroke', 'rgb', 0, 0, 0, 0);
 // black
 // draw ribbon 1
 pdf_moveto($pdf, 630, 150);
 pdf_lineto($pdf, 610, 55);
 pdf_lineto($pdf, 632, 69);
 pdf_lineto($pdf, 646, 49);
 pdf_lineto($pdf, 666, 150);
 pdf_closepath($pdf);
 pdf_fill($pdf);
 // outline ribbon 1