0

I have read the similar question related to the topic but unable to find specific solution to my problem.

I have downloaded a invoicer project from Git and it is working fine, What I doubt is a logic is not in my reach as i am unable to figure out how only specific part of page is getting printed while in script it is not mentioned which div tag to print.

Here is link to all the code Git- repository

...\app\server\routes there is file called invoice.js which have print function which only tell what to load when print is clicked for invoices.

exports.print = function print(req, res) {
    if (req.session.user == null) {
        res.redirect('/?from='+req.url);
    } else {
        if (req.query.id) {
            DB.invoices.findOne({_id:new ObjectID(req.query.id)},function(e, result) {
                result = helpers.formatMoney(result);
                res.render('print_invoice', { layout: 'print.jade' ,    locals: {   title: __("Invoice"), result : result, udata : req.session.user } });
            });
        } else {
            res.redirect('/invoices');
        }
    }
};

which redirect to below template.

...\app\server\views there is file called print.jade & print_invoice.jade print.jade is layout file for printing and body of invoice is called in it.

input(type="button", value=__("PRINT"), onclick="window.print()").btn.btn-primary

on this print page simply window.print() is given but i donot understand how it come to know which div to print and what not to.

Here is the screenshot: webpage printpage

Please help me to find out what i am missing.

Thank You so much.

Madhur Gupta
  • 75
  • 1
  • 11

1 Answers1

0

Solution After searching and reading lot of solutions on so, i found that it is pretty simple and nothing to do with jade or javascript and done using css.

Here is how: Solution on SO

Thanks Stack overflow.

Community
  • 1
  • 1
Madhur Gupta
  • 75
  • 1
  • 11