Drupal Print module http://drupal.org/project/print 6.x-1.17 with D6.25 on 2012-08-31
Summary
This module is exceptionally well documented. It is not a simple download, upload and enable kind of module. One error needed fixing to show the site logo, a tweak is needed to print the site slogan. A bit of trouble in printing Ubercart products when using the Acquia Prosper theme; this can also be fixed, but it took a while to get it together. Solutions shown below. Finally I it is nice to have the Print friendly pages, Send email to a friend, and PDF working on the site.
Required
Use of a pdf library, either dompdf, mPDF, TCPDF or wkhtmltopdf is required. This is detailed in INSTALL.txt.
Main function
The module can make available - printer friendly pages - send a friend an email - pdf file
Example function
You want users or customers to be able to print pages conveniently, use an onsite link and form to send a friend the content of page, and allow users to print a pdf file for a page.
Install
Read the project documentation or better the two files that come with the module: INSTALL.txt file for installation - it is very important. You need to deal with installing a library and with making two additions to the robots.txt file. The README.txt has the configuration instructions.
Library
This assumes you have the libraries module installed in modules/libraries - it makes sites/all/libraries shareable among modules - find your library of choice as per instructions - download and upload to sites/all/libraries - make any changes (directory name, permissions) as instructed Very good details in the INSTALL.txt file and individual library install/readme.txt. You can upload more than one library and a radio button in the module settings will give you a choice of which one to use.
Enable
Upload the print module, extract, enable in Site building > Modules, it creates its own main heading - choice to enable: pdf version, printer friendly pages (main), send by email
Permissions
User management > Permissions. - headings: print module, print_mail module, print_pdf module
Manage
Site configuration > Printer, email and PDF versions. We have: - Web page - Email - PDF - Settings I'll not go into all the details. Important to note that each of the three types has a check-mark to use URL aliases. I missed that check-mark the first time.
Error
Logo image can't be found
The logo will not show regardless of whatever library is used, TCPDF or dompdf. TCPDF shows an error page for print and pdf, while dompdf does not print an error but also creates all its output without the image. The print module's logo error is not library related.
TCPDF
- TCPDF ERROR: [Image] Unable to get image: http://sites/default/files/acquia_prosper_logo.png and the page and pdf won't print, email is printed without logo Print creates an incorrect logo URL. Setting it correctly in Site configuration > Printer, email and PDF versions > Settings makes no difference.
Getimages
This happens from time to time. For either TCPDF and dompdf enabled.
They're probably related, I did not see this error after fixing the issue of the logo not showing.
Solution
In the file sites/all/modules/print/print.pages.inc on line 235 remove the slash (only the slash). While there's a patch, I did this by hand. I would believe this will probably be updated with the next version of the module. Source: http://drupal.org/node/1626878
Tweaks
Site slogan
The print module does not print the site slogan for printer friendly pages, send email to friend, and PDF. However I needed this.
Solution
This is a two set solution one for print/pdf, another one for mail. Befor making changes to the two files, be sure to make cop 1. In the file sites/all/modules/print/print.pages.inc modify line 254 like this t('Published on %site_name ENTER SLOGAN HERE') Before doing this, back the file up as a copy such as print.pages_orig.inc and make sure it remains in original state, so that you can revert back to original easily 2. In the file /sites/all/modules/print/print_mail/print_mail.inc change line 169 like this t('!user has sent you a message from !site ENTER SLOGAN HERE') Before doing this, back the file up as a copy such as print_mail_orig.inc and make sure it remains in original state, so that you can revert back to original easily Done. The slogan gets printed and mailed now. I realise that making the change right into code is a no-no, but I had no other alternative. Documented this for on "site and module update" list to keep track of customisations. Certainly there is also a better way to get the configured site slogan to show up automatically, but I was not successful with it (after all I'm not a programmer). Tips are welcome.
Print module doesn't print Ubercart product pages with Acquia Prosper
My solution fits my situation an may not be complete for your situation. But it does show one direction to get there. For unknown reason, printer friendly pages and PDF will not print the content of Ubercart product pages - while Send a friend an email does this just fine - when using Acquia Prosper with Ubercart, or any other theme that is based on Fusion. Apparently Print and PDF can't read the "fusion_uc_zzz" calls, while Send email is able to read it. From that it would not be illogical to deduct that that the issue may be with the print module php programming. However this fix addresses the custom template.
General solution
The fix is in modifying the Acquia Prosper & Fusion supplied product template file sites/all[or default]/themes/acquia_prosper/node-product.tpl.php Here I replaced the needed "fusion_uc_zzz" calls with the standard (non-fusion) Ubercart calls. This to some extent affects the Acquia Prosper related css theming for Ubercart product pages - but not too much. Major caveat here is that I have not found the names of all of the possible calls there - because in my product pages I only show the display price and nothing else. However, these can be found with "development " modules (which I do not use) and function call lists on Drupal. So this shows the direction, but not all the paths.
Solution 1
The simplest fix is to not use the node-product.tpl.php template, and let Ubercart vanilla take care of the template - this fixes the issue quickly. Simply change the filename to node-product_orig.tpl.php and it's done. This is not good if there is important custom layout in node-product.tpl.php.
Solution 2
Remains a choice between making changes to the existing file or make an entirely new one with the same name. In my case I go with making changes to the existing customised file. Before starting on this make a safe backup by copying node-product.tpl.php to something like node-product_orig.tpl.php What does not work is this http://drupal.org/node/1089524 replace $fusion_uc_body => $content because apparently "$content" inserts the entire Ubercart product content into the custom node-product.tpl.php thereby duplicating the image and the pricing details and add to cart section. This may work for other themes, but not a Fusion based theme. We simply need to get to work more fine-grained. In node-product.tpl.php:
Replacing the description body text
Find
Replace with
content['body']['#value']; ?>
You may wish to test this first. You should see the body text printing/pdf'ing. This should also work without the div brackets. ---------
Replacing the image
Find
Replace with
content['image']['#value']; ?> ---------
Replacing the display price
Find
Replace with
---------
Replacing add to cart
Find
Replace with
--------- Test it. The product description, image, display price and add to cart button will print and will PDF now. Send email to a friend still works. Your page should render with the same layout as before. Some custom css may need to be redone. There may be variations in using print theme or print $node->. I did not experiment with this further (this sufficed, while I'm not a programmer). Basically my sources were the discussions on how to modify the Ubercart template. You may need to change all of the fusion_uc_zzz calls. But I think you catch the drift! Related http://www.ubercart.org/forum/support/17603/ubercart_theme_nodeproduct_pages_custom_image_display_modified_html http://www.ubercart.org/forum/support/973/rearranging_add_cart_button http://drupal.org/node/1089524 $fusion_uc_body => $content solution http://devliegendebrigade.nl/wiki/index.php/Productpagina_themen_%28%C3%9Cbercart%29 http://www.ubercart.org/docs/user/10968/theming_product_pages http://drupalbin.com/8376