Entity Print Module: Create PDF from HTML
If you want to send the PDF directly to the user then you can do something like this:

// Get your HTML from Solr.
$html = $this-&gt;getHtmlFromSolr();

$print_engine = \Drupal::service('plugin.manager.entity_print.print_engine')-&gt;createSelectedInstance('pdf');

$print_engine-&gt;addPage($html);
$print_engine-&gt;send('mydocument.pdf');