0

I am attempting to use dompdf to convert my html document to pdf. However, I am receiving the following error code: Parse error: syntax error, unexpected 'use' (T_USE) in C:\xampp\htdocs\dompdf\pdf.php on line 6

My code is below:

<?php

require_once 'dompdf/autoload.inc.php'

// reference the Dompdf namespace
use Dompdf\Dompdf;

// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF to Browser
$dompdf->stream();

?>

I used the following documentation to help develop the above code: https://github.com/dompdf/dompdf

Dougieeee
  • 1
  • 1

1 Answers1

0

Just add ; after require_once 'dompdf/autoload.inc.php'

Fatemeh Gharri
  • 369
  • 2
  • 6
  • 20