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
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).
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.
- To begin with, download and install the Printer, email, and PDF module.
- You can now configure the basic options for the module by selecting Site configuration and then Printer-friendly pages from the Administer menu.
- 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.
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.
- 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.
- 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.
- 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:
- 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.
- 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:
- TCPDF: http://tcpdf.org
- dompdf: http://www.digitaljunkies.ca/dompdf/faq.php
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.
- After you have installed TCPDF and/or dompdf, you can access the PDF tabbed page in the Printer-friendly pages configuration.
eBook Price: $26.99
Book Price: $44.99
- 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:
- 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:
- 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:
- 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.
- 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:
- 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:
- 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.
- 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:
- After the customer clicks Send e-mail, the site will generate the email for the customer, and send it to the specified recipient.
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:
eBook Price: $26.99
Book Price: $44.99
About the Author :
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.