view entity set value drupal 8 code example
Example: drupal 8 entity_view
$view_builder = \Drupal::entityTypeManager()
->getViewBuilder($entity->getEntityTypeId());
$entityView = $view_builder
->view($entity, 'pdf');;
$view_builder = \Drupal::entityTypeManager()
->getViewBuilder($entity->getEntityTypeId());
$entityView = $view_builder
->view($entity, 'pdf');;