salut, j'ai cherché en vain pour savoir pourquoi ce code simple ne marche pas

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
<?php
 
$fich="C:\test.pdf";
$pdf=pdf_new();
pdf_open_file($pdf,$fich);
pdf_set_info($pdf,"Author","moustaf");
pdf_set_info($pdf,"Title","super le titre");
pdf_set_info($pdf,"Creator","createur");
pdf_set_info($pdf,"Subject","du pdf dur");
pdf_begin_page($pdf, 595, 842);
pdf_add_bookmark($pdf,"la page",0,TRUE);
$font=pdf_findfont($pdf,"Courier","host",FALSE);
if ($font){
pdf_setfont($pdf,$font,30);
} else {
die("police babou");}
pdf_set_value($pdf,"textrendering",1);
pdf_show_xy($pdf,"cool",50,750);
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
 
 
$taille=filesize($fich);
header("content-type: application/pdf");
header("content-length:".$taille);
header("content-disposition: inline; filename=test.pdf");
readfile($fich);
unlink($fich);
 
 
?>
En fait il me genere l'erreur
Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope' in C:\wamp\www\script_admin\test_pdf.php:11 Stack trace: #0 C:\wamp\www\script_admin\test_pdf.php(11): pdf_begin_page(Resource id #2, 595, 842) #1 {main} thrown in C:\wamp\www\script_admin\test_pdf.php on line 11