using krutidev font to print css in html

14,517

Solution 1

For Hindi font for web page and print, use this CSS:

@font-face {
font-family: 'Kruti Dev';
src: url('../../Content/CustomCSS/Kruti Dev 010.ttf') format('truetype')}

.KrutiDev_hindi_text {
font-family: Kruti Dev !important;
font-size: 18px !important;}

Add KrutiDev_hindi_text class to the div you want to apply Hindi fonts to and add reference to this CSS in print function, i.e. strid=div id that you want to print.

Print function:

function CallPrint(strid) {

    var panel = document.getElementById(strid);
    var printWindow = window.open('', '', 'letf=100,top=100,width=600,height=600');

    printWindow.document.write('<html><head><meta charset="utf-8" /><title> </title>');

    printWindow.document.write('</head><body >');
    printWindow.document.write('<div class="container-fluid">');
    printWindow.document.write(panel.innerHTML);
    printWindow.document.write('<\/div>');
    //printWindow.document.write('<link href="/Content/bootstrap.css" rel="stylesheet" />');
    printWindow.document.write('<script src="/Scripts/jquery-1.9.1.min.js"><\/script>');
    //printWindow.document.write('<script src="/Scripts/bootstrap.min.js"><\/script>');
    printWindow.document.write('<link href="/Content/BhardwajCustom.css" rel="stylesheet" />');
    printWindow.document.write('<style><\/style>');
    printWindow.document.write('</body>');
    printWindow.document.write('</html>');
    printWindow.document.close();

    //printWindow.print();
    setTimeout(function () {
        printWindow.print();
    }, 100);
    return false;
}

Solution 2

Quoting kruti dev word solved my problem.

@font-face{
  font-family: 'kruti dev';
  /*****/
}

and where you use too.

Tested in Chrome, IE and FireFox.

Share:
14,517
Gautam Menariya
Author by

Gautam Menariya

I am three year experienced website developer from India.

Updated on June 04, 2022

Comments

  • Gautam Menariya
    Gautam Menariya almost 2 years

    here is my css

    @font-face {  
      font-family: kruti dev ;  
      src: url( '../../fonts/k010.ttf' ) format("truetype");  
    }  
    
    .hinditext {
        font-family: kruti dev;  
        font-size:18px;
    }
    

    and here is my html

    <h3 class="hinditext">lkoZtfud izU;kl efUnj Jh egkdkys'oj </h3>
    

    when i display page in browser, then it show content in Hindi as below Browser display

    but when i give print commend ie print content in english like lkoZtfud izU;kl efUnj Jh egkdkys'oj.

    Please can anyone tell me how i solve this issue and print content in hindi.

  • The Vee
    The Vee over 7 years
    The author of the question is not using Unicode but a font that displays A - Z as Hindi characters. So this is not going to help.
  • Fiddles
    Fiddles over 6 years
    url quotes can be single, double, or not present
  • Ankur Rupapara
    Ankur Rupapara over 6 years
    is it fixed or not??
  • Mozahler
    Mozahler over 5 years
    Welcome to Stack Overflow! Code-only answers are discouraged. Please click on edit and add a paragraph or two summarizing how your code addresses the question. Thanks.