the controller only builds the model. the view renders the html. to get the html as a string in the controller, it must directly call a view render directly. see this article:
note: the more common approach is to use javascript to render the pdf. see: