Hello,

I did a search for printer-friendly views, and there seems to be a lot of confusion surrounding the combination of these two modules (Print and Views).

Can the Print module do this? If not, can someone suggest a viable solution? Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smscotten’s picture

I'm not sure exactly what you're asking. If you want to know whether you can use the Printer, email and PDF versions module with pages made by a View with display type Page, then the answer is yes. You might have to add your own links (/print/whatever) but it will just work.

haopei’s picture

Thanks for the reply, smscotten. I think you have answered my question.

I had wanted to know if this module can print a view. You're saying I can simply create a view with a 'page' display, and print the page instead.

Thanks again.

jcnventura’s picture

Status: Active » Fixed
drupalina’s picture

Hi, I'm also interested in making some of my Views printable, because my end-users narrow down their selections trough filters, and once they have the list that they are interested in, they would often like to print it on their printer.

I googled for some documentation on how to make this work, but couldn't find anything. So , how can we make Views printable?

jcnventura’s picture

You add the view path to the module's system page visibility settings.

drupalina’s picture

inside Show link in system (non-content) pages I selected Show on only the listed pages entered the following:

blog
blog/latest
blog*

and I can't see the Print link anywhere!
Maybe I need to enter something in View's header?

drupalina’s picture

please ignore my previous comment #6. I forgot to set the permissions. All working perfectly now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ressa’s picture

Version: 6.x-1.14 » 7.x-2.x-dev

I think this could be added to the module's description:

This module allows you to generate the following printer-friendly versions of any node or View

DevElCuy’s picture

Status: Closed (fixed) » Needs review

(Sorry for resurrecting this issue)

Got a use case where a bit deeper integration with views is needed. Some themers hate to have the "Printer-friendly version" link rendered somewhere else than within the actual views header/footer. It will be nicer to have a global views field that could be attached into the views header and plays well along with other options like custom texts and page numeration.

DevElCuy’s picture

Patch for comment at #11 attached.

DevElCuy’s picture

Got to fix file paths from previous patch.

DevElCuy’s picture

This new version adds the missing QUERY_STRING (v1=val1&v2=val2) to the print link.

DevElCuy’s picture

New patch that adds the static val: PRINT_PATH and adds the missing printlinks.css file on the view page, along with the print-link class into the anchor, so the link inherits predefined CSS rules.

zilla’s picture

i read about another option on some other site that encountered this and what they did was insert some code into GLOBAL HEADER for the view, as PHP on input filter - and this way it will fully respect ANY filters that you apply to the view (very useful if you expose filters.

my only problem is that i'd like to style it a bit more (e.g. remove the filter from the printer-friendly iteration and so on)

here's the snippet for D7:

<?php $current_url = getenv('REQUEST_URI'); ?>
<img src='/sites/all/modules/print/icons/print_icon.png'>
<a href='/print<?php print $current_url; ?> '>Printer-friendly version</a>
jmev’s picture

How do you theme a view that's rendered with this print module? Is there a naming convention that will enable the module to use the template, perhaps print--html--node--viewname.tpl.php, or something similar?

kumkum29’s picture

Hello,

I use the "views admin" module to manage users via a view.
I want to use a link to print results from this view in a pdf. This view includes a display page.
How do I include a link on this view to print the results? (the default path of this view is admin/people)
I have tested with admin/people/print/pdf (in path of the view) without success.

Thank you for your help.

dbourrion’s picture

Had the same need here.
I simply put in the footer of the view a php code :

$current_url = 'http://' .$_SERVER['HTTP_HOST'] .'/print'.$_SERVER['REQUEST_URI'];
echo "<a href=".$current_url.">PRINT</a>";
wesleybpereira’s picture

Assigned: Unassigned » wesleybpereira
Issue summary: View changes
FileSize
43.45 KB

Good evening to all!
First of all, I want to say that my English is bad and so I'm using Google translator (I'm from Brazil) and I also want you to forgive me if you're posting in the wrong place.
Friends, I need your help with the following: I created a page view with nodes of a particular content type. In this view created a table that displays the type, the title and author of the nodes. Can you help me insert a link Print the entire contents of that view? I want to generate a PDF / Print with Title and Body of all nodes listed in this view.
Note: Attached following image of my page view. I do not know to program in PHP, so if someone could put the code that is needed will be very happy! :)

Regards,

fgjohnson@lojoh.ca’s picture

wesleybpereira,

You could also use Views Data Export to export the contents of the currently filtered view to .CSV (Excel) and print from there.

dinarcon’s picture

This is an update to @develCuy's patch at #15 with the following change: !current_path does not include the website's base path nor PRINT_PATH. By doing this, it is possible to override in the Views UI which print format I want to use by setting the link anchor tag to: "/print/!current_path", "/printpdf/!current_path", etc.

dureaghin’s picture

Patch #22 doesn't working as expected. Still can't print view block.

adriancid’s picture

Component: Documentation » Code
Assigned: wesleybpereira » Unassigned
FileSize
4.04 KB

This is an update to @develCuy's patch at #15 with the following change:

Add multilingual support.
And add a pdf image to the link

basya82’s picture

I have a problem with printing view. Prints the link to page instead contents.

Тhis is my code.

a href="http://portalmam.com/print/103" title="Display a printer-friendly version of this page." class="print-page" onclick="window.open(this.href); return false" rel="nofollow"

basya82’s picture

I have problem. Page created using views printing as a link of page instead the contents of this page.

redhatusr’s picture

I can't print block created from views

I have tried with domPDF and with the mPDF
I have tried to print the block with php from page.tpl.php or just to set it visible from drupal block mamagment
I have tried the patch #24 and #22 and the footer code of #19

any solution ?

adriancid’s picture

@redhatusr If you use the patch #24 Add in the Footer of your Views this: Global: Printer-friendly version an you will see the link

redhatusr’s picture

@adriancid the problem is not the link.
The problem is the code in page.tpl.php that print a views block is ignored by this module.

    $block = module_invoke('views', 'block_view', 'move_lines-block');
    print render($block['content']);
adriancid’s picture

redhatusr’s picture

@adriancid the _views_ block that i print with php in the page.tpl.php is working fine when i view the page (node/11).
The problem is only in print (print/11) and pdf (printpdf/11)

SocialNicheGuru’s picture

it no longer applies:

patch -p1 < print_printing-views_1421724-24.patch
patching file includes/print_views_handler.inc
patching file print.info
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file print.info.rej
patching file print.views.inc
Hunk #1 succeeded at 16 (offset -1 lines).
Hunk #2 succeeded at 117 (offset -4 lines).

more print.info.rej
--- print.info
+++ print.info
@@ -3,5 +3,12 @@
core = 7.x
package = "Printer, email and PDF versions"
files[] = print_join_page_counter.inc
+files[] = includes/print_views_handler.inc
dependencies[] = node
configure = admin/config/user-interface/print
+
+; Information added by Drupal.org packaging script on 2014-04-02
+version = "7.x-2.0"
+core = "7.x"
+project = "print"
+datestamp = "1396426766"