MVC code to print on standard Envelopes / Labels

395 views Asked by At

Does anyone know of any opensource code, or have any code I can use, that can be used in an MVC application to print (addresses) on envelopes (where the size can be selected) or to standard sized labels (again with a size etc can be selected).

This must be a common scenario, but I can't find any reusable code

1

There are 1 answers

0
artm On

You can call window.print() from javascript but you can't specify the paper size etc. That's up to the user to select on the print dialog box. window.print() will print the entire page though, if you want to print only selected parts of the page you can use media css to hide elements from the print output. i.e.

@media print
{
    .noprint {display:none;}
}

and add the class .noprint to the elements that you don't want to get printed.