I´m trying to use the entity_print module for generating a PDF in Drupal 8. I want to print out HTML. My module has no entities it gets data from a solr server and generates HTML output.
My first thing is to make a route and a sort of flag to fire the pdf generation:
mymodule.page_detail:
path: '/detail/{Title}/{ObjIdentifier}'
defaults:
_controller: '\Drupal\mymodule\Controller\myController::detailpage'
Title: ''
ObjIdentifier: ''
ViewPdf: '0'
...
mymodule.page_detail_pdf:
path: '/detail/pdf/{Title}/{ObjIdentifier}'
defaults:
_controller: '\Drupal\mymodule\Controller\myController::detailpage'
Title: ''
ObjIdentifier: ''
ViewPdf: '1'
...
Then in my Controller I check for
if (isset($myModuleViewPdf) && $myModuleViewPdf == "1") {
...
Now the entity Print magic should come into play. I use the services and make a print engine and a print builder:
$print_engine = \Drupal::service('plugin.manager.entity_print.print_engine')->createSelectedInstance('pdf');
$print_builder = \Drupal::service('entity_print.print_builder');
Now I´m struggeling somehow. When I look over the functions docroot/modules/entity_print/src/PrintBuilder.php
I see that they are using entities for the output but I want to use HTML. How can I do this?
Greetings Lars