Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use jquery in mPDF html render page #1030

Closed
Johnny1210 opened this issue May 4, 2019 · 1 comment
Closed

How to use jquery in mPDF html render page #1030

Johnny1210 opened this issue May 4, 2019 · 1 comment

Comments

@Johnny1210
Copy link

Can I use jquery into html page which one I want to make PDF
if I only return the html page jquery works fine
but whenever I call mpdf jquery does not work for me

This is a PHP code snippet I use

<?php
$html = (view("Template::pdf"));

$mpdf = new mPDF([
            'tempDir' => storage_path(),
            'mode' => 'utf-8',
            'format' => [257, 364],
            'margin_top' => '5',
            'margin_left' => '8',
            'margin_right' => '8',
            'margin_bottom' => '8',
            'autoLangToFont' => true,
            'autoScriptToLang' => true,
            'orientation' => 'L'
        ]);
$mpdf->WriteHTML($html);

This is a HTML/CSS code snippet I use

<table border="2" cellpadding="0" cellspacing="0" style="width:600px;">
   <tr width="600px">
       <td align="center" style="padding-top:15px;">
            <h1 style="font-family:Arial;font-size:78px;text-align:center;margin:0;color:#878E96;font- 
                  weight:700;line-height: 84px;width:600px;"
                  id="logo_name"
                  class="insertBossierText">
                    Opeer Town
             </h1>                                                                                    
      </td>
   </tr>
</table>
<script src="{{asset('asset/lib/jquery/jquery.js')}}"></script>
<script language="javascript">
    jQuery(document).ready(function ($) {
        $("#logo_name").text("LOGO NAME");
    });
</script>
@Johnny1210 Johnny1210 changed the title How to use jquery in html render page How to use jquery in mPDF html render page May 4, 2019
@ssieb
Copy link

ssieb commented May 4, 2019

mpdf is not a browser. It does not have a JavaScript engine. So no, you can't use jquery.

@finwe finwe closed this as completed May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants