home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / pdflib / pdflib-4.0.1.sit / pdflib-4.0.1 / bind / php / personalize.php < prev    next >
Encoding:
PHP Script  |  2001-04-18  |  1.7 KB  |  68 lines  |  [TEXT/LMAN]

  1. <?php
  2. # $Id: personalize.php,v 1.6 2001/04/18 10:16:13 tm Exp $
  3. $col1 = 70;
  4. $col2 = 335;
  5. $infile = "PDFlib-purchase-order.pdf";
  6.  
  7. $p = PDF_new();
  8.  
  9. PDF_open_file($p, "");
  10.  
  11. PDF_set_info($p, "Creator", "personalize.php");
  12. PDF_set_info($p, "Author", "Thomas Merz");
  13. PDF_set_info($p, "Title", "PDFlib personalization demo (php)");
  14.  
  15. $form = PDF_open_pdi($p, $infile, "", 0);
  16. if (!$form) {
  17.     die( "Couldn't open input file '%s'.");
  18. }
  19.  
  20. $page = PDF_open_pdi_page($p, $form, 1, "");
  21. if (!$page) {
  22.     die("Couldn't open page 1 in ".$infile);
  23. }
  24.  
  25. $font = PDF_findfont($p, "Helvetica-Bold", "host", 0);
  26.  
  27. # get the dimensions of the imported form
  28. $width = PDF_get_pdi_value($p, "width", $form, $page, 0);
  29. $height = PDF_get_pdi_value($p, "height", $form, $page, 0);
  30.  
  31. PDF_begin_page($p, $width, $height);
  32. PDF_place_pdi_page($p, $page, 0, 0, 1, 1);
  33. PDF_close_pdi_page($p, $page);
  34.  
  35. PDF_setfont($p, $font, 18);
  36. PDF_set_value($p, "leading", 24);
  37. PDF_set_text_pos($p, $col1, 486);
  38.  
  39. PDF_show($p, "Doublecheck, Inc.");
  40. PDF_continue_text($p, "Petra Porst");
  41. PDF_continue_text($p, "500, Market St.");
  42. PDF_continue_text($p, "94110 San Francisco, CA");
  43. PDF_continue_text($p, "");
  44. PDF_continue_text($p, "USA");
  45. PDF_continue_text($p, "+1/950/123-4567");
  46. PDF_continue_text($p, "+1/950/123-4568");
  47. PDF_continue_text($p, "");
  48. PDF_continue_text($p, "petra\@doublecheck.com");
  49.  
  50. $datestr = date("j M Y");
  51. PDF_set_text_pos($p, $col2, 152);
  52. PDF_continue_text($p, $datestr);
  53.  
  54. PDF_end_page($p);
  55. PDF_close($p);
  56. PDF_close_pdi($p, $form);
  57.  
  58. $buf = PDF_get_buffer($p);
  59. $len = strlen($buf);
  60.  
  61. header("Content-type: application/pdf");
  62. header("Content-Length: $len");
  63. header("Content-Disposition: inline; filename=pdfclock_php.pdf");
  64. print $buf;
  65.  
  66. PDF_delete($p);
  67. ?>
  68.