Freebies and Downloads in Drupal 6: Part 2

Exclusive offer: get 50% off this eBook here
Drupal 6 Site Builder Solutions

Drupal 6 Site Builder Solutions — Save 50%

Build powerful website features for your business and connect to your customers through blogs, product catalogs, newsletters, and maps

$26.99    $13.50
by Mark Noble | November 2009 | MySQL Content Management Drupal PHP Web Development

Read Part One of Freebies and Downloads in Drupal 6 here.

Automatically generating PDF files for a page

Good Eatin' Goal: Generate PDF files of our pages so that the users can automatically download the pages for printing, or for offline usage.

Additional modules needed: Printer, email, and PDF (http://drupal.org/project/print).

Basic steps

As you continue to work on your web site, you will find that many users want access to your content, even if they aren't online. With the Printer, email, and PDF module, you can easily and automatically provide content in various formats for offline usage.

  1. To begin with, download and install the Printer, email, and PDF module.

    Freebies and Downloads in Drupal 6

  2. You can now configure the basic options for the module by selecting Site configuration and then Printer-friendly pages from the Administer menu.
  3. The general settings are accessed by clicking on the Settings tab. These settings are shown below, and include options to style the printable pages, and to determine whether or not URLs and comments are displayed on the page. You can also control how the page is opened, and also which logos are displayed on it.

    Freebies and Downloads in Drupal 6

    By expanding the Source URL section, you can cause the URL of the page to be included on the printed output. You can also optionally add the date and time when the page was generated to the printed output.

  4. The printable page (web page) configuration options include a variety of options to control how the links to the printable versions are displayed, as well as how the printable pages are displayed.

    Freebies and Downloads in Drupal 6

  5. We have modified the Printer-friendly page link to be in the Content corner rather than in the Links area. You can also optionally display the printable page in a new window and automatically call the print function, as needed.
  6. Opening the Advanced link options gives you additional options for how the link is displayed, and what pages it should be displayed on, as shown in the following screenshot:

    Freebies and Downloads in Drupal 6

  7. The Robots META tags section allows you to prevent search engines from indexing your printable version, which will help to ensure that visitors are directed only to your online content. This can also help prevent duplicate content penalties being imposed by search engines.
  8. To create PDFs, we need to install a third-party tool to handle the conversion. You can choose from either TCPDF or dompdf, which are available at the following locations:

    You can install and use either of these. You can also install both of them and switch between the two, while you evaluate which one will meet the needs of your site best.

  9. After you have installed TCPDF and/or dompdf, you can access the PDF tabbed page in the Printer-friendly pages configuration.
Drupal 6 Site Builder Solutions Build powerful website features for your business and connect to your customers through blogs, product catalogs, newsletters, and maps
Published: December 2008
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:
  1. The PDF generation options are similar to the printable web page options, but with a few additions. To begin with, you need to select which generation tool is to be used, as shown in the following screenshot:

    Freebies and Downloads in Drupal 6

  2. You can also control the paper size and orientation to be used in the PDF, as well as font sizes, and whether the PDF should be displayed after it is created, as shown in the following screenshot:

    Freebies and Downloads in Drupal 6

  3. After all of the options have been updated, you will see a set of links for printing the page or exporting it to a PDF file, as shown below:

    Freebies and Downloads in Drupal 6

  4. Clicking on the printer icon will remove most of the styling, as shown in the following screenshot, so that the user can print the page from within the browser.

    Freebies and Downloads in Drupal 6

  5. If the user clicks on the PDF icon, a PDF will be generated, and either displayed to the user or saved to the user's hard drive, as shown in the following screenshot:

    Freebies and Downloads in Drupal 6

  6. Giving visitors the ability to send pages to other users via email is configured in a similar way to configuring PDF generation. In the Printer-friendly pages configuration page, you simply click on the e-mail tab to edit the settings, as shown in the following screenshot:

    Freebies and Downloads in Drupal 6

  7. It is a good idea to set a low Hourly threshold for the number of emails that can be sent, to prevent users from abusing this feature. Leaving the Send only the teaser option enabled is a great way of ensuring that email recipients are directed to your site to read the rest of the content.
  8. When a customer wants to send content via email, they simply click on the Send to a friend link that appears on the page. Drupal will then present a form similar to the following screenshot:

    Freebies and Downloads in Drupal 6

  9. After the customer clicks Send e-mail, the site will generate the email for the customer, and send it to the specified recipient.

    Summary

    In this article, we reviewed some methods of making the most out of the downloadable content. As long as you provide high quality downloadable content, your customers will appreciate getting something useful from you. In return, you receive the opportunity to market to your customers.

    The amount of downloadable content for a site will vary depending on the goal of the web site, as well as the requirements of the visitors to the site.

    We have also discussed automatic creation of PDF files for offline use as well as for printing. This is a great way of allowing your users to make use of the site even when they are not actively browsing the site, online.

    [ 1 | 2 ]

If you have read this article you may be interested to view:

Drupal 6 Site Builder Solutions Build powerful website features for your business and connect to your customers through blogs, product catalogs, newsletters, and maps
Published: December 2008
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

About the Author :


Mark Noble

Mark Noble has worked in software development and website design for over 13 years in a variety of capacities including development, quality assurance, and management. He takes pride in developing software and websites to make businesses run more effectively and delights in helping users to get their jobs done more easily.

Mark currently works developing websites to help libraries manage their books. He also does occasional contract work for clients in a variety of industries.

When he isn’t in front of a computer, Mark enjoys playing with his family, photography, and geocaching.

Books From Packt

Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQuery

Joomla! E-Commerce with VirtueMart
Joomla! E-Commerce with VirtueMart

jQuery UI 1.6: The User Interface Library for jQuery
Grok 1.0 Web Development

Drupal 6 Site Blueprints
Drupal 6 Site Blueprints

Drupal 6 Content Administration
Drupal 6 Content Administrationion

Zend Framework 1.8 Web Application Development
Zend Framework 1.8 Web Application Development

Drupal 5 Views Recipes
Drupal 5 Views Recipes

Learning jQuery 1.3
Learning jQuery 1.3

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software