As an easier alternative to this, you can use Print link plugin https://www.seblod.com/store/extensions/21189 that can be applied to text or buttons

This tutorial walks through how to create a "print" button within your SEBLOD Content View. 

  1. In Joomla, the /templates/$template/component.php file controls the layout of the print view of an article (see this Joomla documentation for more information)
  2. You can access this template, with the contents of your Content View, by adding the following variables to the end of your URL: ?tmpl=component&print=1.
  3. So, in your Content View, add a custom link to your printable page which looks like: would be www.yourwebsite.com/your-article-content-view?tmpl=component&print=1 - one way to achieve this is by using a position override and the code:

    <a href="/<?php echo JURI::current(); ?>?tmpl=component&print=1" target="_blank">Print</a>

  4. You can then alter the layout / formatting of your print page by editing the component.php file of your Joomla template.

If you'd like to render your Content View contents in a pdf file, please follow this Joomla documentation as a guide.