Formats
Image Example 1
<?php 
 $p 
PDF_new(); 
 
PDF_open_file($p); 
 
PDF_begin_page($p,595,842); 
 
$im pdf_open_jpeg($p"php-big.jpg");
 
pdf_place_image($p$im2007001.0);
 
pdf_place_image($p$im2006000.75);
 
pdf_place_image($p$im2005350.50);
 
pdf_place_image($p$im2005010.25);
 
pdf_place_image($p$im2004860.10);
 
$x pdf_get_value($p"imagewidth"$im);
 
$y pdf_get_value($p"imageheight"$im);
 
pdf_close_image ($p,$im);
 
$font PDF_findfont($p,"Times-Bold","host",0);
 
PDF_setfont($p,$font,28.0);
 
pdf_show_xy($p,"$x by $y",25,800);
 
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=coords.pdf");
 echo 
$buf
 
PDF_delete($p); 
?>
Output
Scaling an Image
We saw in the previous example how to scale an image linearly. We can also scale non-linearly. To do this we scale the coordinate system appropriately:

Image Example 2
<?php 
 $p 
PDF_new(); 
 
PDF_open_file($p); 
 
PDF_begin_page($p,595,842); 
 
$im pdf_open_jpeg($p"php-big.jpg");
 
pdf_place_image($p$im2007001.0);
 
PDF_save($p);  // Save current coordinate system settings
 
$nx 50/PDF_get_value($p,"imagewidth",$im);
 
$ny 100/PDF_get_value($p,"imageheight",$im);
 
PDF_scale($p$nx$ny);
 
pdf_place_image($p$im200/$nx600/$ny1.0);
 
PDF_restore($p);  // Restore previous
 
pdf_close_image ($p,$im);
 
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=coords.pdf");
 echo 
$buf
 
PDF_delete($p); 
?>
Output