mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
# $id$
|
||||
|
||||
$p = PDF_new();
|
||||
PDF_open_file($p, "");
|
||||
|
||||
PDF_set_info($p, "Creator", "image.php");
|
||||
PDF_set_info($p, "Author", "Rainer Schaaf");
|
||||
PDF_set_info($p, "Title", "image sample (PHP)");
|
||||
|
||||
$imagefile = "nesrin.jpg";
|
||||
|
||||
$image = PDF_open_image_file($p, "jpeg", $imagefile, "", 0);
|
||||
if (!$image) {
|
||||
die("Couldn't open image ".$imagefile);
|
||||
}
|
||||
|
||||
# See the PDFlib manual for more advanced image size calculations
|
||||
$width = PDF_get_value($p, "imagewidth", $image);
|
||||
$height = PDF_get_value($p, "imageheight", $image);
|
||||
|
||||
# We generate a page with the image's dimensions
|
||||
PDF_begin_page($p, $width, $height);
|
||||
PDF_place_image($p, $image, 0, 0, 1);
|
||||
PDF_close_image($p, $image);
|
||||
PDF_end_page($p);
|
||||
|
||||
PDF_close($p);
|
||||
|
||||
$buf = PDF_get_buffer($p);
|
||||
$len = strlen($buf);
|
||||
|
||||
header("Content-type: application/pdf");
|
||||
header("Content-Length: $len");
|
||||
header("Content-Disposition: inline; filename=image.pdf");
|
||||
print $buf;
|
||||
|
||||
PDF_delete($p);
|
||||
?>
|
||||
Reference in New Issue
Block a user