Passing HTML to the response object I had this piece of code in a module developed for some previous version of Drupal 8.

protected function getOutput() {
    $content = $this-&gt;buildContent();
    //print_r($content);
    $page = array(
      '#theme' =&gt; 'html',
      '#page_object' =&gt; new Html(render($content)),
    );
    $rendered_page = render($page);
    return $rendered_page;
}


Now, in the present beta release, it shows this error: 


  Fatal error: Class 'Drupal\hardcopy\Plugin\Html' not found in C:\xampp\htdocs\drupalbeta7\modules\custom\hardcopy\src\Plugin\HardcopyFormatBase.php on line 175


Can someone tell me how to pass the HTML of the whole page in the response object?
As D8 uses Symfony responses it's as simple as:

use Symfony\Component\HttpFoundation\Response;

...

$response = new Response(
  'Your HTML content here',
  Response::HTTP_OK,
  array('content-type' =&gt; 'text/html')
);

return $response;


See the docs for more information.