A Very Simple Way to Print the Entire Page in Joomla and Not Just the Content

Note: The menu item solution in this post requires a small modification to a core Joomla file. Unfortunately, there is no way around this. If you’re not comfortable doing this, then please contact us and we’ll do it for you. We can also create an extension that allows you to do the below without modifying any core file (this would take time though).

Some websites want their users to print the whole page, and not just the content of the page, and that’s why the print functionality at the article level does not cut it for them (because it’ll print just the content). As a workaround, these websites tell their visitors to print the page from the browser, by clicking on the menu icon (the three horizontal bars on the top right in FireFox or Chrome, or the gear icon, also on the top right, in IE), and then choosing Print. Of course, this is not ideal, because many Internet users are extremely non-technical. This means that there is a need of having a Print button (on the website itself) that prints the entire page.

But, how to do that?

Well, there are a couple of ways of doing it:

  1. Using a custom HTML module

    Just create a custom HTML module that contains the following code:

    <a href="javascript:window.print();">PRINT</a>

    Assign this module to your desired position, and that’s it!

  2. Using a Menu Item

    If you want to place the Print link in a menu, then you will need to do the following:

    • Open the file item.php located under the administrator/components/com_menus/controllers.
    • Change the following line:

      $scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais', 'url', 'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git');

      to this one:

      $scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais', 'url', 'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git', 'javascript');

    • Create a new menu item of type External URL .

    • Add the following code as the Link:

      javascript:window.print();

    • Save the menu item and check the menu where you have the Print link. It should be working.

    Note that if you don’t modify the item.php you will get the following error: Save not permitted (Joomla, by default, does not allow you to add JavaScript as the menu item link).

If you’re having problems implementing the above, then all you need to do is to contact us. We’ll do it for you in not time and for a very affordable fee!

No comments yet.

Leave a comment