Migrate from Dompdf¶
Keep PHP in charge of the view, including totals and row generation. Send the completed HTML to PressJet and return the PDF bytes through the response you already use for downloads.
Replace the PDF step¶
Install the PHP SDK or call the PressJet HTTP endpoint with your PHP client's JSON request support. Send version: 1 and the populated html as shown in the render API. Keep the API key in your backend configuration.
With the PHP SDK installed, a file-based smoke test looks like this:
<?php
require __DIR__ . '/vendor/autoload.php';
$pressjet = new Pressjet\Client(
apiKey: getenv('PRESSJET_API_KEY'),
baseUrl: 'http://127.0.0.1:8080',
);
$html = file_get_contents(__DIR__ . '/invoice.html');
if ($html === false) {
throw new RuntimeException('Could not read invoice.html');
}
file_put_contents(__DIR__ . '/invoice.pdf', $pressjet->html($html));
For a framework controller, pass the rendered view string to the same method and send the returned bytes with the PDF content type.
Compare layout and resources¶
Move remote images and fonts into explicit attachments or embedded resources. Test page counters, headers, and long tables that cross page boundaries. If the template already has page-break-* rules, keep them for the first comparison. For differences, consult the HTML compatibility reference and review the output with the migration checklist.