4

I have tried PDF using mPDF and Printer-friendly pages (Drupal 7.x). They both need own styling of an output. I have got a CSS that formats my pages for printing. I would like to generate PDFs by just "printing" to them. I do not want to maintain separate styles.

Is there a module that generate a PDF file with an output that would be sent to a printer?

1
  • If you need css handling I guess your best bet would a local webserver that takes screenshots, there are plenty of similar question on stackoverflow for that issue. but for sake of ease implement any webservice for that, I made some good experience with convertapi.com additionally you will probably have to make sure the right css is used for that request. Commented Mar 17, 2013 at 3:23

1 Answer 1

4

Try Printer, email and PDF versions module.

This module allows you to generate the following printer-friendly versions of any node:

Printer-friendly version (webpage format) (at www.example.com/print/nid)

PDF version (at www.example.com/printpdf/nid)

Send by email (at www.example.com/printmail/nid)

where nid is the node id of content to render.

6
  • It uses its own print.tpl.php template. I would like something that builds a content using my hmtl.tpl.php, page.tpl.php etc.
    – NetExpert
    Commented Mar 16, 2013 at 17:25
  • @NetExpert, how can you do that? If we use page.tpl.php we will get all css/images in print page. If you still want to use page.tpl.php consider invoking the theme fn provided by that module
    – niksmac
    Commented Mar 17, 2013 at 4:06
  • @nikhil-m I use CSS (print media) to hide what I do not want. You can look at Zen template for an example. The module makes an output inconsistent. You receive a different looking page that one you receive by using a print command of a browser.
    – NetExpert
    Commented Mar 17, 2013 at 7:53
  • @nikhil-m Using a theme function looks promising. I replaced print.tpl.php content with <?php print theme('html', $variables); ?>. I have got my html now. However a page content is missing. How should I build a render array for a page (I believe I could add it within theme_preprocess_print())?
    – NetExpert
    Commented Mar 17, 2013 at 9:28
  • 1
    @NetExpert, take a look at how they print/render content in print.tpl.php
    – niksmac
    Commented Mar 17, 2013 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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