I'm trying to use DOMPDF to make a PDF out of this: https://devcoursetransfer.northcarolina.edu/bdp.html
It is coming up up with this: https://devcoursetransfer.northcarolina.edu/Test.pdf
It's changing the aspect ratio of the image, but more importantly, it's running off the right side of the page. Is there any way I can fix these two problems?
Code below:
// Instantiate and use the dompdf class
$options = new Options();
// can fetch remote files
$options->set('isRemoteEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtmlFile('https://devcoursetransfer.northcarolina.edu/bdp.html');
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
ob_clean();
$dompdf->stream('Test.pdf');
exit;
Figured it out through trial and error. There is a lot of CSS that DOMPDF doesn't handle correctly.
There is an element that has these styles:
Which makes it look good on the web, but causes DOMPDF to shift everything to the right and off the PDF.
So, I added a class pdfview when creating a pdf, and added this CSS
I plan to switch to a better tool soon.