ich dies wie folgt vor: How to get page number on dompdf PDF when using "view"Call to undefined Methode Barryvdh dompdf PDF :: setOptions() (Laravel 5.3)
I $pdf->setOptions('isPhpEnabled', true);
hinzuzufügen, ist wie folgt:
public function listdata()
{
$data = User::all();
$pdf=PDF::loadView('print_tests.test_pdf', ['data' => $data]);
$pdf->setOptions('isPhpEnabled', true);
$pdf->setPaper('L', 'landscape');
return $pdf->stream('test_pdf.pdf');
}
Im Körper (View) I hinzufügen wie folgt aus:
<script type="text/php">
if (isset($pdf)) {
$x = 72;
$y = 18;
$text = "{PAGE_NUM} of {PAGE_COUNT}";
$font = $fontMetrics->get_font("helvetica", "bold");
$size = 6;
$color = array(255,0,0);
$word_space = 0.0; // default
$char_space = 0.0; // default
$angle = 0.0; // default
$pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
}
</script>
ist es Fehler wie diese vorhanden sind:
FatalThrowableError in PrintTestController.php line 21: Call to undefined method Barryvdh\DomPDF\PDF::setOptions()
Ich versuche Änderung wie ths zu sein: $pdf->set_options('isPhpEnabled', true);
Es ist nicht zu arbeiten
Hinweis:
ich mit barryvdh/Laravel-dompdf ": "^ 0.7.0"(v0.7)
Gibt es Leute, die mir helfen können?
UPDATE
Ich versuche noch einmal wie folgt aus:
use Dompdf\Dompdf;
public function listdata()
{
$data = User::all();
$pdf = new Dompdf();
$pdf->set_option("isPhpEnabled", true);
$pdf=PDF::loadView('print_tests.test_pdf', ['data' => $data]);
$pdf->setPaper('L', 'landscape');
return $pdf->stream('test_pdf.pdf');
}
Kein Fehler, aber Seitennummer unsichtbar
Ich benutze dies: https://github.com/barryvdh/laravel-dompdf. Scheint anders –
Das ist nur ein Wrapper um die Klasse für leichteren Zugang in Laravel. – miken32