Print option / button for List

Status
Not open for further replies.

pkjoshi

Active Member
I am really feel myself dumb asking this question?

I couldn't find or enable a print option for List/Table. This must be apparent, but I am unable to locate it.

Thanks.
 
You have only a print icon option for forms, not lists.
In Fabrik 2, there is an option for PDF but I think it's been removed in F3 because of J! poor implementation of PDF rendering.
 
It's really disappointing to know that you cannot take a print out of the list/tables, which is indispensable at many occasions.

I have never seen an application, which doesn't allow you to print.

I am sure Fabrik being such a beautiful application cannot handicap it by ignoring such basic functionality, which is so vital.
 
To Rob: Ctrl+P is not at all a solution, that prints everything on the page including the webpage menus, headers etc.
To jfquestiaux:Thank you very much for showing one direction.
To Rob & jfquestiaux: I will be more than happy to do it whith the help of print.css, but I need some more assistance in that direction like
A -Where the print.css file will go
B - How to link the print.css file with the list
C- how to invoke the print.css file when giving the print command as Rob said Ctrl+P is not going to invoke the print.css file.

Thank you once again jfquestiaux
 
The way I would handle this is the following :


  1. Make a duplicate of the "default" list template folder and rename it the way you want. In your list setting, choose this new template as the layout template
  2. In the default.php file of your new template, put the following code :
    Code:
    $document = JFactory:: getDocument();
    $document->addStyleSheet( JURI::base() . 'components/com_fabrik/views/lists/tmpl/your_template/print.css', 'text/css', 'print' );
  3. Then you write a print.css file (obviously, you need (some) knowledge on how CSS works) and save it at the root of your list template folder.
Through this print.css, you can really have a printed copy of your list exactly the way you want (removing headers, menus,... of your site template). It is included automatically on the page(s) that use your list template.


You may have to struggle a little to get it right if your site template includes also a print.css file, so you'll need to use the specificity of rules to get it work. Firebug is your friend to debug this.
 
Thanks a lot jfquestiaux,
I do not have an expertise on it, but have a working knowledge of CSS. I will give it a go and let you know the result.

Thanks once again.
 
I have included the line in default.php file and the contents of my file goes like this just for testing:
header('Content-type: text/css');

#header, #nav, {display: none;}

.calclabel{
display:none;
}
the above .calclabel class with display:none, when used in template_css.php works fine. but I remove the same from template_css.php and put it as it is in print.css it doesn't have any affect on the print.
which means the print.css stylesheet is completely ignored while printing though the same is included in the page header see image.

I mean there is no affect with or without this print.css file.
 

Attachments

  • print-css.PNG
    print-css.PNG
    7.4 KB · Views: 480
When your CSS rules don't seem to work as they should, there are usually two reasons :

  1. The CSS is not taken into account, so first check it is actually called on the page (seems to be the case), then check the name and path to see if they match the actual location of the file. Finaly make a test by setting some rule with an "obvious" rule like setting a background color to red for some div. If that shows, then your file is recognized, so go to point 2.
  2. The rules are overriden by others in different CSS files (that's the "C" in "CSS"). For that, the best is to use Firebug to find which rule overrides yours and try to be more specific.
It would be easier if you could provide an url where we could look at your page.


Finally, you have an error in your first CSS rule. It should be
Code:
#header, #nav {display: none;}
without a "," after #nav
 
OK, I got the code.
First of all, your when I try to get to your print.css file, I get a 404 error which means that your file is not where it is supposed to be. You need to fix that first.
 
OK,
I have copied that code you mentioned earlier in the default.php file without looking at it closely. Actually lists should have been list in the path.
Now It's working like a charm.
Thanks once again jfquestiaux for guiding me to achieve it.
 
coming back to this as someone was asking if its still relevant.
The most important thing to know is that CSS has a @media property which allows you define specific CSS for various media types.
http://www.w3schools.com/css/css_mediatypes.asp
This allows you very quickly to set display:none on all the parts of the page you don't want to print.

Also in the code at github we have re-implemented the pdf feature which will print out the compents content area to a pdf file.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top