Use dompdf in phabricator

23 views Asked by At

I want to create new fiture to generate pdf on my phabricator.
I try to import dompdf into my phabricator, but when i try to call the function on my dompdf file it won't return anything and the dompdf->stream wont run i write my dompdf code below this

 <?php require (__DIR__ . '/vendor/autoload.php');
use Dompdf\Dompdf;
function push(){
    $html = "hello world";
    $dompdf = new Dompdf();
    $dompdf->loadHtml($html);
    $dompdf->setPaper('A4', 'potrait');
    $dompdf->render();
    $filename = 'doc.pdf';
    $dompdf->stream("dompdf_out.pdf");

}

And this is my phabricator function to call it

    <?php


$root = dirname(phutil_get_library_root('phabricator'));
require_once $root.'/externals/dompdf/push.php';

final class PhabricatorPeopleGenerateCVController
  extends PhabricatorPeopleController {


public function shouldRequireAdmin() {
  return false;
}    
public function handleRequest(AphrontRequest $request) {

  
  $view_uri = "/p/{$request->getViewer()->getUsername()}/";
  
  push();
 return  id(new AphrontRedirectResponse())->setURI($view_uri);
}
} 

any solution about my problem?

0

There are 0 answers