Print the form only on the view single page

Print the form only on the view single page

by Paul Young -
Number of replies: 5

Dear all,

I created the following form on the View single page. Now I want to print the form only without the Moodle site name, page number, etc. On some comercial sites, there is a print button that can do that. Is it possible to do this in Moodle? Thanks

Average of ratings: -
In reply to Paul Young

Re: Print the form only on the view single page

by Itamar Tzadok -

Much simpler. Add to the css template a definition such as the following:

@media print{

div.header,div.title{display:none;}

}

such that  div.header,div.title is a list of all the items you don't want to display for printing. The list of items to exclude depends on the theme you use so you need to explore the page (with e.g. firebug) to see which items to exclude. Then the print option of the browser will do.

hth smile

Average of ratings: Useful (2)
In reply to Itamar Tzadok

Trả lời: Re: Print the form only on the view single page

by Henry Nguyen -

Hi tamar Tzadok

I try doing what you told but It doesn't work. When I print single view (Ctrl+P) on Chrome browser. It still consist header, title and everything on real view. 

 Please help me. 

Many thanks, 

Henry

In reply to Henry Nguyen

Re: Trả lời: Re: Print the form only on the view single page

by William Lu -

Below is what I learnt from Itamar's previous posts:

  • You need a Print button in 'View list' and 'View Single'
  • You need define the style of print area in CSS template
  • You need JS in JS template

Please download the attached preset and copy all codes into your templates.

All credits and thanks go to Itamar.

Average of ratings: Useful (1)
In reply to William Lu

Trả lời: Re: Trả lời: Re: Print the form only on the view single page

by Henry Nguyen -
Many many thanks to all of you. I did it. I copy all the code to the related templates and it work now. It's so great. I can print data for my students now. I'm so happy. 

Once again, I'd like to thank you all and wish you a best luck.


Henry