123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <!DOCTYPE html>
- <html lang=ko>
- <head>
- <meta charset="utf-8">
- <title>Issue 363: korean is broken</title>
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
- <script type="text/javascript" src="../libs/FileSaver/FileSaver.min.js"></script>
- <script type="text/javascript" src="../libs/jsPDF/jspdf.umd.min.js"></script>
- <script type="text/javascript" src="../tableExport.js"></script>
- <style type="text/css">
- <!--
- caption {
- font-size: 1em;
- white-space: nowrap;
- text-align: left;
- }
- table {
- border-collapse: collapse;
- margin-top: 2em;
- }
- table > thead > tr > td,
- table > thead > tr > th {
- background-color: gray;
- border: 1px solid #efefef;
- color: white;
- padding: 0.2rem;
- }
- table > tbody > tr > td {
- border: 1px solid #999;
- padding: 0.2rem;
- }
- -->
- </style>
- <script type="text/javaScript">
- function doExport(selector, params) {
- var options = {
- tableName: 'Table name'
- };
- $.extend(true, options, params);
- $(selector).tableExport(options);
- }
- function doDocCreated(doc) {
- // In the next line replace <base64> with a base64 encoded font,
- // e.g GowunDodum-Regular.ttf from Google Fonts family "Gowun Dodum".
- // To do this, you need to upload your Korean font to a Base64 file encoder
- // and use its output in place of <base64> while preserving the apostrophes
- // so it would look similar like this:
- // const _fonts = "AAEAAAAQAQAABAAAR0RFRtwiqrwAAAIUAAABzEdQT1OlZYtBA ... sBHBcKLy4BERYQAR4VAAAA";
- const _fonts = "<base64>";
- if (_fonts === "<base64>") {
- alert ("Missing base64 encoded font, e.g GowunDodum-Regular.ttf");
- return;
- }
-
- doc.addFileToVFS('GowunDodum-Regular.ttf', _fonts);
- doc.addFont('GowunDodum-Regular.ttf', 'GowunDodum-Regular', 'normal');
- doc.setFont('GowunDodum-Regular');
-
- doc.text(15, 120, '안녕하세요'); // Example text output
- }
- </script>
- </head>
- <body>
- <p>
- <a href="#" onClick="doExport('#issue363',
- {type: 'pdf',
- jspdf: {orientation: 'l',
- onDocCreated: doDocCreated,
- autotable: {startY: 10,
- margin: {left: 10, top: 10},
- pageBreak: 'avoid'
- }
- }
- });">
- <img src='icons/pdf.png' alt="PDF" style="width:24px"> PDF (jsPDF)</a>
- </p>
- <table id="issue363" class="">
- <caption>Issue 363: Korean pdf export</caption>
- <thead>
- <tr>
- <th>안녕하세요</th>
- <th>안녕하세요</th>
- <th>안녕하세요</th>
- </thead>
- <tbody>
- <tr>
- <td>안녕하세요</td><td>안녕하세요</td><td>안녕하세요</td>
- </tr>
- <tr>
- <td>안녕하세요</td><td>안녕하세요</td><td>안녕하세요</td>
- </tr>
- <tr>
- <td>안녕하세요</td><td>안녕하세요</td><td>안녕하세요</td>
- </tr>
- </tbody>
- </table>
- </body>
- </html>
|