Entity print get variable in twig template
Looks like you need to review Entity Print in Drupal 8 again. I am using the Entity Print module and it works just fine. Here are some pointers I would recommend below. Your original post is regarding printing node variables in twig templates


On your content type, navigate to Manage Display-->Expand Custom Display Settings-->Enable PDF. This will create a PDF view mode (which is used for printing)
Create a twig template node--article--pdf.html.twig (replace article with machine name of your content type)
Update your_theme.info.yml and your_theme.libraries.yml as suggested in Entity Print in Drupal 8 so you can control the theme and assign a css file only for print
Copy and add entity-print.html.twig to your subtheme
Using node--article--pdf.html.twig, you can control whatever variable you need. However, I recommend you use the PDF view mode first to see what it can do for you. 


I have yet to use a preprocess function and you should only need that if you need additional processing. Using the PDF view mode, entity-print.html.twig and the node--article--pdf.html.twig templates you will be able to print as you need. 

Ultimately, you should use the PDF view mode so you can manage the PDF view mode (add classes, divs, order, add/hide/remove fields, etc.) through the UI. I have found that managing what fields are displayed through code can be cumbersome if you have a lot. The view mode can handle a lot of what you need, but you need to enable the PDf view mode first. 

Sample entity-print.html.twig

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;{{ title }}&lt;/title&gt;
  {{ entity_print_css }}
&lt;/head&gt;
&lt;body&gt;
  &lt;div class="optional_class"&gt;
      {{ content }}
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


Sample node--article--pdf.html.twig:

&lt;article class="optional_class_wrapper"&gt;
  {{ content.field_name }}
  {{ content.body }}
  {{ label }} 
  {{ content.field_name.0.value }}
&lt;/article&gt;