2017-05-15 5 views
1

ich nginx und HHVM auf meinem Ubuntu-Server verwendet, und mikehaertl/phpwkhtmltopdf Paket in Laravel für PDF-Generierung, sondern erzeugen pdf in HHVM Inhalt zeigt unten und in meinem lokalen Rechner funktioniert gut:generiert pdf in HHVM arbeitet nicht

enter image description here

Mein Code ist:

$logo = storage_path('logo/logo.jpg'); 
    $font = storage_path('fonts/IRRoya.ttf'); 
    $barcode = DNS2D::getBarcodePNG($order["registration_number"], "QRCODE",5,5); 
    $date = jDateTime::strftime('Y-m-d H:i:s', strtotime($order['order_date'])); 
    $f_date = jDateTime::convertNumbers($date); 
    $view = view('bill.bill',compact('order','logo','font','barcode','f_date')); 
    $pdf = new Pdf(array(
     'no-outline', 
     'margin-top' => 0, 
     'margin-right' => 0, 
     'margin-bottom' => 0, 
     'margin-left' => 0, 
     'disable-smart-shrinking', 
     'commandOptions' => array(
      'useExec' => true, 
      'procEnv' => array(
       'LANG' => 'fa_IR.utf-8', 
     ), 
    ), 
    )); 
    $pdf->addPage($view); 
    $pdf->send(); 

Wie kann ich es beheben?

+0

Sie die ' 'Content-Header richtig Baumuster zur senden? – apokryfos

+0

'phpwkhtmltopdf' nicht? – amirali

+0

Hängt davon ab, wie Sie es verwenden – apokryfos

Antwort

0

fand ich die Lösung:

$logo = storage_path('logo/logo.jpg'); 
    $font = storage_path('fonts/IRRoya.ttf'); 
    $barcode = DNS2D::getBarcodePNG($order["registration_number"], "QRCODE",5,5); 
    $date = jDateTime::strftime('Y-m-d H:i:s', strtotime($order['order_date'])); 
    $f_date = jDateTime::convertNumbers($date); 
    $view = view('bill.bill',compact('order','logo','font','barcode','f_date')); 
    $pdf = new Pdf(array(
     'no-outline', 
     'encoding' => 'UTF-8', 
     'margin-top' => 0, 
     'margin-right' => 0, 
     'margin-bottom' => 0, 
     'margin-left' => 0, 
     'disable-smart-shrinking', 
     'commandOptions' => array(
      'useExec' => true, 
      'procEnv' => array(
       'LANG' => 'fa_IR.utf-8', 
     ), 
    ), 
    )); 
    $pdf->addPage($view); 
    $content = $pdf->toString(); 
    return response($content)->withHeaders([ 
      'Content-Type' => 'application/pdf', 
      'Pragma' => 'public', 
      'Content-disposition' => 'attachment; filename='.$order["registration_number"].'.pdf', 
      'Content-Transfer-Encoding' => 'binary', 
      'Content-Length' => strlen($content) 
     ]);