<?php
define("PAGE_WIDTH", 612);
define("PAGE_HEIGHT", 792);
$pdf = pdf_new();
pdf_begin_document($pdf, "", "");
pdf_begin_page($pdf, PAGE_WIDTH, PAGE_HEIGHT);
$gd_logo = imagecreatefromjpeg("logo.jpg");
$logo = pdf_open_memory_image($pdf, $gd_logo);
$logo_w = pdf_get_value($pdf, "imagewidth", $logo);
imagedestroy($gd_logo);
pdf_place_image($pdf, $logo, PAGE_WIDTH/2 - ($logo_w/2), PAGE_HEIGHT/2, 1.0);
pdf_close_image($pdf, $logo);
pdf_end_page($pdf);
pdf_end_document($pdf, "");
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=example1.pdf");
header("Content-length: " . strlen($data));
echo $data;
?>