<?php

$p = PDF_new();
PDF_open_file($p);
PDF_begin_page($p, 595, 842);
PDF_moveto($p, 150, 750);
PDF_lineto($p, 450, 750);
PDF_lineto($p, 100, 800);
PDF_curveto($p, 80, 500, 70, 550, 250, 650);
PDF_stroke($p);
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=gra1.pdf");
echo $buf;
PDF_delete($p);
 function Curve($xo, $yo, $x, $y, $px1, $py1, $px2, $py2, $linha = 2.001, $color1 = '#000000', $color2 = '#000000')
 {
     if ($teck2) {
         $this->SetLine($linha);
         $this->SetBoth($color1);
         $this->SetFill($color2);
     }
     PDF_moveto($this->pdf, $xo, $yo);
     PDF_curveto($this->pdf, $px1, $py1, $px2, $py2, $x, $y);
     if ($teck) {
         PDF_stroke($this->pdf);
     }
     if ($this->depurar) {
         echo '<b>PDF:</b> Adicionado uma curva.<br>';
     }
 }