0

これは、 pdfmake を使用した単純な html ファイルです。ボタンをクリックして、pdf ファイルを開きます。使用:

pdfMake.createPdf(docDefinition).open();

大丈夫ですが、pdfpage で特定の言語 (例: バングラ) を見たいと思っています。いかがでしょうか。助けてください、または私に提案してください。

ヘッダー部分:

<head>
    <!--    <meta charset="utf-8" />-->
    <meta http-equiv="Content-Type" content="text/html" meta charset="utf-8" />
    <title>html to pdf</title>
    <link href="css/main.css" rel="stylesheet">
    <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
    <script src='pdfmake/build/pdfmake.min.js'></script>
    <script src='pdfmake/build/vfs_fonts.js'></script>
    <script src='build/pdfmake.min.js'></script>
    <script src='build/vfs_fonts.js'></script>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

</head>

ボディパーツ:

<body>

    <h1>Hello World</h1>
    <div class="btn-group">
        <div class="btn btn-success buttin_click_1" type="button">download</div>
        <div class="btn btn-danger button_click_2" type="button">open</div>
    </div>

</body>

脚本 :

<script>
    $(document).ready(function () {
        var docDefinition = {
            content: 'This is an sample PDF printed with pdfMake ami '
        };

        $('.buttin_click_1').click(function () {
            console.log('btn 1 clicked');
            pdfMake.createPdf(docDefinition).open();
        });

        $('.button_click_2').click(function () {
            console.log('btn 2 clicked');
        });
    });
</script>

ありがとうございました 。

4

1 に答える 1