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 / hello.php next >
Encoding:
PHP Script  |  2001-05-16  |  652 b   |  32 lines  |  [TEXT/LMAN]

  1. <?php
  2. # $id$
  3.  
  4. $p = PDF_new();
  5. PDF_open_file($p, "");
  6.  
  7. PDF_set_info($p, "Creator", "hello.php");
  8. PDF_set_info($p, "Author", "Rainer Schaaf");
  9. PDF_set_info($p, "Title", "Hello world (PHP)");
  10.  
  11. PDF_begin_page($p, 595, 842);
  12. $font = PDF_findfont($p, "Helvetica-Bold", "host", 0);
  13. PDF_setfont($p, $font, 18.0);
  14.  
  15. PDF_set_text_pos($p, 50, 700);
  16. PDF_show($p, "Hello world!");
  17. PDF_continue_text($p, "(says PHP)");
  18.  
  19. PDF_end_page($p);
  20. PDF_close($p);
  21.  
  22. $buf = PDF_get_buffer($p);
  23. $len = strlen($buf);
  24.  
  25. header("Content-type: application/pdf");
  26. header("Content-Length: $len");
  27. header("Content-Disposition: inline; filename=hello.pdf");
  28. print $buf;
  29.  
  30. PDF_delete($p);
  31. ?>
  32.