I've had a difficult time trying to load images to the pdf with pdflib, and tried many examples. I came across this one and it actually works for me in IE and Firefox. I hope this can be of some help to someone.
<?php
$searchpath = "path/to/image/dir";
$p = new PDFlib();
$p->set_parameter("errorpolicy", "return"); $p->set_parameter("hypertextencoding", "winansi"); $p->set_parameter("SearchPath", $searchpath); if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
$p->set_info("Creator", " the creator");
$p->set_info("Author", " you ");
$p->set_info("Title", " imageInsert ");
$p->begin_page_ext(612, 792, ""); $certLogo = "stamp.jpg"; $image = $p->load_image("auto", $certLogo, "");
if (!$image) { die("Error: " . $p->get_errmsg()); }
$p->fit_image($image, 390,575, ""); $p->close_image($image); $p->end_page_ext("");
$p->end_document("");
$data = $p->get_buffer();
$len = strlen($data);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $data;
$p = 0;
?>