I'm trying to use the Print module to generate pdf's and epubs of the stories on my site. However, I need to get Print to generate these files from the story page and then generate the pdf with ALL nodes that reference the story, the chapters. I'm not sure how to do this as I've never really done tpl.php's before. I need some help here.

Can print be made to work with a panels layout that shows what I want in it? I have a panels layout working mostly for an example of what I'm trying to achieve.


How do I make the tpl.php file I need to make that end up as my print selections for Stories?


Seeing the url for print layout works fine, my first suggestion would be, that you can actually do it simply by activating the pdf module and changing the path to trigger the 'pdf-generator':

print-path: http://fanbards.net/print/stories/13008

printpdf-path: http://fanbards.net/printpdf/stories/13008

…you may find further useful info about this on the documentation page for Print.

  • I tried that initially, but the module wouldn't do it, it would only output the node content. I created a tpl.php file, it's not greate and it depends on views but it worked. I'll post that here
    – CW Smith
    Mar 25 '15 at 14:35

Well, I managed to create a content type based template for print. I'm not sure if it's the best way but it's what I came up with. Any improvments would be appreciated.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>">
    <?php print $head; ?>
    <base href='<?php print $url ?>' />
    <title><?php print $print_title; ?></title>
    <?php print $scripts; ?>
    <?php if (isset($sendtoprinter)) print $sendtoprinter; ?>
    <?php print $robots_meta; ?>
    <?php if (theme_get_setting('toggle_favicon')): ?>
      <link rel='shortcut icon' href='<?php print theme_get_setting('favicon') ?>' type='image/x-icon' />
    <?php endif; ?>
    <?php print $css; ?>
<?php if (!empty($message)): ?>
      <div class="print-message"><?php print $message; ?></div><p />
    <?php endif; ?>
    <?php if ($print_logo): ?>
      <div class="print-logo"><?php print $print_logo; ?></div>
    <?php endif; ?>
    <div class="print-site_name"><?php print theme('print_published'); ?></div>
    <p />
    <div class="print-breadcrumb"><?php print theme('print_breadcrumb', array('node' => $node)); ?></div>
    <hr class="print-hr" />
    <?php if (!isset($node->type)): ?>
      <h2 class="print-title"><?php print $print_title; ?></h2>
    <?php endif; ?>
    <div class="print-content"><?php print views_embed_view ('story_summary','print_story_pane', $node->nid); ?></div>
    <div class="print-content"><?php print views_embed_view('print_views','print_chapter_pane', $node->nid); ?></div>
    <div class="print-content"><?php print views_embed_view('print_views','print_authors_note_pane', $node->nid); ?></div>
<div class="print-footer"><?php print theme('print_footer'); ?></div>
    <hr class="print-hr" />
    <?php if ($sourceurl_enabled): ?>
      <div class="print-source_url">
        <?php print theme('print_sourceurl', array('url' => $source_url, 'node' => $node, 'cid' => $cid)); ?>
    <?php endif; ?>
    <div class="print-links"><?php print theme('print_url_list'); ?></div>
    <?php print $footer_scripts; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.