You are here

README.txt in Area Print 7

Same filename and directory in other branches
  1. 6 README.txt
Area Print is a simple module that let's you add print button or link that sends any given element(with id) to printer. 
All drupal-css is applied and you can append your own on top of that.

In it's current form, the module provides only API-like functionality, no UI at all, though this may change in the future.

USAGE:

Where ever you can add php code(php-field, text-area with php input format, custom module, template, etc.), 
you can call the button like this:
print area_print_form($options);
where $options is an associative array containing:

 - target_id: Id of the element you want to print (optional, defaults to 
   'content'),

 - button_id: Id that will be given to the print link or button (optional,     
   defaults to 'area_print_button'),

 - value: The text for the link/button (optional, defaults to t('print')),

 - type:  either 'link' or 'button' (optional, defaults to 'button'),

 - custom_css: path to a css file that will get added to the page before    
   printing (optional).

 - hide_button: either TRUE or FALSE(optional, defaults to FALSE). Hides the  
   print button or link itself when printing. Can be useful if the print   
   button is in the printed container.

Example:

In your custom template, or php-node, or somewhere:

1. First define your printable area like this:

  <div id="my_printable_div">
    I want to print this!
  </div>


2. Then print the button:

<?php
$options = array(
  'target_id' => 'my_printable_div',
  'button_id' => 'my_print_button',
  'value' => t('Print'),
  'type' => 'link',
  'custom_css' => drupal_get_path('module','my_module').'/css/print.css',
  'hide_button' => TRUE,
  );

print area_print_form($options);
?>

KNOWN PROBLEMS:
As always, Internet Explorer acts unlike all the other browsers, and this module is no exception.
There is a problem where IE cannot "catch-up" with the changes made to the page with javascript 
before printing and closing the page. As a temporary solution, when you print with IE, you will 
see alert box saying "Press OK to print". This gives the browser enought time to complete it's tasks. 
I will try to come up with better solution, but in the meanwhile, this works(and patches are welcome).

File

README.txt
View source
  1. Area Print is a simple module that let's you add print button or link that sends any given element(with id) to printer.
  2. All drupal-css is applied and you can append your own on top of that.
  3. In it's current form, the module provides only API-like functionality, no UI at all, though this may change in the future.
  4. USAGE:
  5. Where ever you can add php code(php-field, text-area with php input format, custom module, template, etc.),
  6. you can call the button like this:
  7. print area_print_form($options);
  8. where $options is an associative array containing:
  9. - target_id: Id of the element you want to print (optional, defaults to
  10. 'content'),
  11. - button_id: Id that will be given to the print link or button (optional,
  12. defaults to 'area_print_button'),
  13. - value: The text for the link/button (optional, defaults to t('print')),
  14. - type: either 'link' or 'button' (optional, defaults to 'button'),
  15. - custom_css: path to a css file that will get added to the page before
  16. printing (optional).
  17. - hide_button: either TRUE or FALSE(optional, defaults to FALSE). Hides the
  18. print button or link itself when printing. Can be useful if the print
  19. button is in the printed container.
  20. Example:
  21. In your custom template, or php-node, or somewhere:
  22. 1. First define your printable area like this:
  23. I want to print this!
  • 2. Then print the button:
  • $options = array(
  • 'target_id' => 'my_printable_div',
  • 'button_id' => 'my_print_button',
  • 'value' => t('Print'),
  • 'type' => 'link',
  • 'custom_css' => drupal_get_path('module','my_module').'/css/print.css',
  • 'hide_button' => TRUE,
  • );
  • print area_print_form($options);
  • ?>
  • KNOWN PROBLEMS:
  • As always, Internet Explorer acts unlike all the other browsers, and this module is no exception.
  • There is a problem where IE cannot "catch-up" with the changes made to the page with javascript
  • before printing and closing the page. As a temporary solution, when you print with IE, you will
  • see alert box saying "Press OK to print". This gives the browser enought time to complete it's tasks.
  • I will try to come up with better solution, but in the meanwhile, this works(and patches are welcome).