Rendering a field in a custom print template I'm using the Printer, email and PDF versions module to render a custom print page in Drupal 7. I'd like to theme the fields individually and have worked that out to the point of using nasty php in my custom template itself. 

So, I have a content type called ecard and following the module's documentation, I'm using print--node--ecard.tpl.php (based on the modules's core print.tpl.php file) for my custom print template. That works fine but the usual ways of rendering individual fields like in a node template don't. 

I can do this within print--node--ecard.tpl.php to render an indivdual field called field_ecard_logo:

&lt;?php 
$ecard_logo = field_view_value('node', $node, 'field_ecard_logo', $node-&gt;field_ecard_logo[$node-&gt;language][0]);
print render($ecard_logo);
?&gt;


... works but kind of nasty. I'd rather put all the logic in my theme's template.php and simply print a variable I've created. Looking at what preprocess functions the Print module uses, I see preprocess_print and preprocess_node. So I tried this in template.php:

  function MYTHEME_preprocess_print($vars) {
      $node = $vars['node'];
      $vars['ecard_logo'] = field_view_value('node', $node, 'field_ecard_logo', $node-&gt;field_ecard_logo[$node-&gt;language][0]);
    }


and then in print--node--ecard.tpl.php, I simply do:

&lt;?php print $ecard_logo; ?&gt;


but that does not work. I tried different incarnations of all this but no joy so at this point I'm stumped.
After a few days of working on this, it ended up being pretty trivial to accomplish this so I'll answer my own question for those who need help in the future. I had most of the solution working but in my custom print template, the key was to have:

&lt;?php print render($ecard_logo); ?&gt;


NOT:

&lt;?php print $ecard_logo; ?&gt; 


So the full function in template.php is:

/**
  * Renders the content of the print page using the theme api.
  */
function usfig_preprocess_print(&amp;$vars, $hook) {

// Global node.
$node = $vars['node'];
// Compartmentalize only for ecard content type.
if($vars['node']-&gt;type == 'ecard') {

// Create a var and render using field_view_value, we don't need anything special for this, otherwise use field_get_items for data parts.
$vars['ecard_logo'] = field_view_value('node', $node, 'field_ecard_logo', $node-&gt;field_ecard_logo[$node-&gt;language][0]);
}

}


... and then in my custom print template I do:

 &lt;?php print render($ecard_logo); ?&gt;


and it works!

Extra credit:

You can create and render an image style with field_view_value as well like so in your theme's template.php file:

 $vars['ecard_image'] = field_view_value('node', $node, 'field_my_image', $node-&gt;field_my_image[$node-&gt;language][0], array(
      'type' =&gt; 'image',
      'settings' =&gt; array(
      'image_style' =&gt; 'my_custom_image_style', 
      'image_link' =&gt; 'none',
      ),
      ));


Then just render the variable in your custom template file!  What's the advantage to all this? It allows for ultra minimalist markup and precise themeing where layout and exactness are crucial. It cuts way down on the "divitis" that drupal tends to have.