Frequently Asked Questions
- I have enabled the module, but the PF page link is not showing up!
- The Printer-friendly version in book nodes is not working correctly.
- The book pages still display the text "Printer friendly pages," and no icon
- Can I replace the 'Printer-friendly version' link with an icon?
- But can I use my own icon?
- Is it possible to place the PF link somewhere else?
- Is it possible to change the styles used in the PF page?
- Is it possible to define a template for a specific content type?
- I don't like the template used. Can I use another?
- I am using a custom template but nothing seems to be working correctly. What's the problem?
- The blocks I have in the 'content' region are not showing up! Why?
- I see a lot of PHP warnings of the type: warning: array_map() [function.array-map]: Argument #2 should be an array in /home/site3/html/sites/all/modules/print/include/abstract_renderer.cls.php on line
- I am a module author/maintainer. Is there a way to know when a node is being built by the print module so that I can disable my output?
- I have a problem/question not answered here. Where can I go for help?
There may be several reasons for this, but try the following in order (you must have appropriate permissions to perform some of these steps - login as user #1 if you don't):
i. Make sure that the module is enabled (the checkbox next to 'Printer-friendly pages' in admin/build/modules must be ticked).
ii. In admin/user/access under the print module heading make sure that you have enabled access to the desired groups. In most cases, you will want to tick the 'access print' boxes for all groups, and clear the 'admin print' boxes for all groups except the administrator group (if defined).
iii. In admin/settings/print, make sure that you have enabled the PF link.
iv. For each content type x, check in admin/content/types/x that the 'Show printer-friendly version link' is enabled.
If you're using Drupal 4.7.x, that PF link is managed by the book module and this module has nothing to do with it. If you're using Drupal 5.x or later try to enable the 'Take control of the book module printer-friendly link' in the Printer-friendly settings form and see if you like it better that way.
It's not a bug.. The 'take control' is precisely that.. Take control, not replace. The book module's link is still left intact, but instead of generating the page via the book module, some of it is generated by the print module.
It's not easy to solve the problem, as I don't want to hijack core features more than I need to, and in this case, there may be themes/modules that are already handling the PF page link in book nodes in ways that would be broken if I were to completely replace the link.
Yes. In the module's settings, set the page link to 'icon only'.
You will have to define a theme_print_format_link function which will replace the module's function with the same name and where you can indicate your custom-defined icon, and set the html element to true so that your image tag is interpreted as HTML. See the following for an example:
<?php
function theme_print_format_link() {
$print_html_settings = variable_get('print_html_settings', print_html_settings_default());
$text = t('Printer-friendly version');
$img = local_path_to_your_img_file;
$title = t('Display a printer-friendly version of this page.');
$class = strip_tags($print_html_settings['link_class']);
$new_window = $print_html_settings['new_window'];
$format = _print_format_link_aux($print_html_settings['show_link'], $text, $img);
return array('text' => $format['text'],
'html' => $format['html'],
'attributes' => print_fill_attributes($title, $class, $new_window),
);
}
?>Yes, but you have to take care of it. Disable the PF link in admin/settings/print and you're then free to place a link to print/nid or to print/path_alias wherever you want (such as a block or the node content). I recommend the following code to place the link, as it maintains the configurable attributes:
<?php
print print_insert_link();
?>You can always change them easily. You can either:
a) Edit the print.css in the modules directory, or
b) Define your own CSS with the appropriate styles and specify it in the module settings.
Yes, the module will try the following locations for the PF page template:
i. print.node-type.tpl.php in the theme directory
ii. print.node-type.tpl.php in the module directory
iii. print.tpl.php in the theme directory
iv. print.tpl.php in the module directory (supplied by the module)
I recommend that you edit the module's print.tpl.php to suit your tastes instead of creating something from scratch, as it is easier to remember the name of the members of the $print array and the names of the used styles.
Note that since you are creating your own template, if you want to use per-content-type styles, you can simply ignore the $print['css'] setting and hard-code your own per-content-type CSS file in your new template. Or you can define your own per-content-type styles to store in the configurable CSS file. Your choice!
See the above question on how to do it (or you can always simply edit the module's print.tpl.php).
Are you using the $node variable in your template? Be aware that the print module's template is not a normal Drupal template, so access to $node (among others) will not work. To fix this, place the following early in your template:
<?php
$node = $print['node'];
?>First, if it is content, then it should be content.. Stuff usually placed in blocks is usually not content, and as such, should not appear in the printer-friendly view. That being said, if you really, really want it, add the following to your template:
<?php
print theme('blocks', 'content');
?>This is caused by a bug in domdpf's code. It is not possible to be fixed by this module. You can however edit line 42 of dompdf_config.inc.php to:
error_reporting(0);
Yes, if $node->printing evaluates to true, disable any output that is not suitable for a static page.
Simply post a new issue in Drupal's issue system: http://drupal.org/project/issues/print
If possible, send me an e-mail with the link to your Drupal system where I can see the problem you are reporting.

remark about 4+5 placing an image link somewhere else
note when upgrading to the new version the previous theme function failed because there is no more print_fill_attributes() function.
another issue is when the developer wants to add a image icon & want to place it somewhere else so there is a 22 catch :
the theme function calls print_format_link_aux() that uses the setting to determine if a text or an image display
so you need to override this , here is what i have done :
function mythemename_print_format_link() {
return array('text' =>"<img src='" . base_path() .path_to_theme()."/images/ico_print.gif' />",
'html' => TRUE,
'attributes' => array());
}
Dev Art- Drupal Based Services and development