I've seen some sites allowing to create a customized PDF or printable page using a basket / cart where putting pages in. In this way, one can print a single page or concatenate multiple pages on his/her own basket.
This module uses a single template to generate PDF, printable pages and emails: now it adopts a per-node approach, allowing to handle a single node (the first use case). I tried to transform the $print array into an array of array passing to _print_generate_node() function an array, instead a single value. With little changes, the print, printmail and printpdf URLs can be adapted as follows:
Where #2 concatenates node 2 and node 1 for print.
With this feature, a print basket can be implemented even with a javascript + cookies based tool (to store nids array) that call that URL (that generates the concatenated content) using this module.
So, the implementation of a working basket should comprehend:
- New URLs implementation and testing
- Basket tool creation for print, mail and pdf (each medium should have his own basket)
I've not tested deeply this code: it surely can be optimized and it covers only the first step. Comments and ideas for a basket tool are warmly welcomed.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 348682-multiple-nodes-print-and-email.patch | 16.18 KB | pkiraly |
| print_pages_concat.patch | 1.97 KB | chirale | |
| print_concat.patch | 3.15 KB | chirale |
Comments
Comment #1
skyredwangIf Printer, e-mail and PDF versions supports Views2, then you just need to use Flag Module to flag nodes, then print out the views result.
Comment #2
jcnventuraI would much rather use an existing solution (Views based) than doing it via this added code.. Can someone try that option and report back if there is anything needed or if "just works".
João
Comment #3
jcnventuraPostponing it..
Comment #4
Chris CharltonI understand this is postponed. I'd like to comment this would be a neat next-gen feature.
Comment #5
newtonpage commentedI have a similar need (not a basket but a "print checked items" button) that would print the selected nodes - - but I cannot seem to make it work right. Love to know a solution if one exists. This requirement also maps to "email checked items".
This would be great enhancement but I realize it may be somewhat complex - - the views path seems most promising but I cannot see how to do it.
N
Comment #6
pkiraly commentedI have enhanced chirale's patch, and now with this you can print and email multiple nodes. You can call:
http://example.com/print/1
http://example.com/print/1,2
http://example.com/printemail/1
http://example.com/printemail/1,2
I will use this patch in the eXtensible Catalog project, and I commited this patch there as http://drupal.org/cvs?commit=386506. If you have tried this patch, please tell me your suggestions and critiques, because this functionality is important for us, and I would like to improve it, or at least fix its bugs (if any).
Regards,
Péter
Comment #7
Bobuido commentedSubscribing
This would be cool
Comment #8
konrad1811 commentedsubscribing
Comment #9
jelo commentedBased on the information from this topic, I build a view that allows me to print multiple pages into one PDF. Create a view named print_basket or whatever that takes NID as argument in the url and allow multiple arguments. I used the path "p" for a page display to keep it very short.
Example: www.example.com/p/3,5,8
Display fields title and body (in my case all that is needed as I am only printing pages, if you use CCK or custom content types you would need to select the CCK fields to be displayed) in the view. This will produce a page that shows nodes 3,5 and 8 all on one page.
Add printpdf prior to your view URL: www.example.com/printpdf/p/3,5,8
Give it a nice alias.
This works for me to create PDFs from various pages on the site (preconfigured with a nice URL). If you want your users to select what they want to print, you might be able to expose filters to them in the view that allow selection of pages to be included...
Cheers, J.
Comment #10
j4 commentedHi,
Can you provide a link so that we can see where you have used this?
Thanks
Jaya
Comment #11
MBroberg commentedI was able to create a view that shows all desired records on the site, but breaks into desired pages when printing to a pdf. I have not tested with an actual printer, but I think it would work.
The key is to use views, div tags, and css.
Here is what I did:
Create a view with the necessary fields.
Exclude them all, add a Global custom text field at the bottom.
Use tokens to rewrite everything as you want it to show on the printed page, and surround with div tags and a class.
<div class="mypage">[field token 1] and [field token2]</div>This creates a record that has a "mypage" class which can be styled with css.
Use the css property
page-break-after: always;
for your .mypage class
The screen will not recognize it, but it sends the message to the printer to break the page after each record.
Thus the css has to be set on the "print.css" stylesheet.
I was able to use css injector module to get my code on certain pages.
(Clear caches after editing the css.)
Now when I print to a pdf file I get page breaks after each record.
I assume you can use this trick to create page breaks wherever you want.
I use views_field_view module to create views of more than one record and nest them inside of other views using arguments.
That way I get a multi-layered grouping, with page breaks after each master group.
Comment #12
MBroberg commentedI should add that I did not need to apply the patch above.
I like the idea of a "basket" or "cart" though, using flags or some such idea.
http://drupal.org/project/flag_page looks interesting, possibly as a way to add a flag to pages you want to print.
How to empty the basket after printing though, that would be important...
Comment #13
jelo commentedHi MBroberg,
Thanks for sharing your approach. Did you make any progress on the flagging?
Right now I am considering how to integrate this idea with the menu. I often get the request from users to be able to print a whole section (defined with regard to the menu as a parent page and all child pages). The book module comes with the functionality to print the whole book and I think people like the idea of being able to print several pages that are related through the IA structure, ie. menu structure. I have a print page button on all of my pages, but would like to add print section button if a page has children.
I do not want to go off topic, but it just seems to be a variation of the print basket. In one scenario we let the user pick which pages to print (by flagging it or putting it in the basket, in another scenario we present a preselected selection of pages, e.g. based on menu structure, for printing. Any ideas how to achieve this?
Regards, J.
Comment #14
gaëlgI'm about to give this patch a try, as I need the same kind of thing.
I started dealing with the problem in the other way, by implementing the basket feature first (not using Flag as I needed something simple but somewhat specific):
http://drupal.org/sandbox/gaelg/1378676
Comment #15
jcnventuraAs stated multiple times in this thread, this is possible using Views (and flags or exposed filters).
Views is better suited to the task of creating a custom list of nodes, than I could ever try to be in the module. And I really don't want to re-implement views inside this module.
Comment #16
userspan commentedCreate multiple print node in drupal 7???