首页 > 解决方案 > 使用 KENDO 的 Jquery Grid 打印 PDF 时出现奇怪的字符

问题描述

我正在使用 Kendo 的 Grid for Jquery 开发一个包含许多列的表。包括 Kendo 提供的以 .xlsx 和 .pdf 格式打印表格的按钮,问题在于 PDF 打印机。看一下 PDF 的 doc 属性:

PDF 属性

我正在尝试从生成的 PDF 的属性中删除此特殊字符 ('þÿ')。至少来自“标题”(título,在最后一张图片中)。这是我的代码:

用于 PDF 的“页面模板”:

<script type="x/kendo-template" id="page-template">
<div class="page-template">
    <div class="header">
        <h3 align="center" style="margin: 1px;"><strong>Cuenta Corriente: Vista Composición</strong></h3>
        <div style="display: flex; flex-direction: column; justify-content: flex-start; align-content: flex-start;">
            <p style="margin: 1px;">Cuenta Correntista: `v-cuit` , `v-desRazonSocial`.</p>
            <p style="margin: 1px;">Fechas Consulta: `vFdesde` al `vFhasta`.</p>
            <p style="margin: 1px;">Solicitado por: `AsamaUsuarios.ident_usua`.</p>
        </div>
    </div>
    <div class="footer">
        Página #: pageNum # de #: totalPages #
    </div>
</div>

JavaScript 代码:

$(document).ready(function() {
    $("#grid").kendoGrid({
            sortable: true,
            noRecords: true, 
            messages: {
                commands: {
                  search: "Buscar..."
                }
            },
            toolbar: ["search","excel", "pdf"],
                excel: {
                        fileName: "ComposicionCtaCte.xlsx"
                    },
                pdf: {  
                        title: "Composicion Cta Cte",
                        fileName: "ComposicionCtaCte.pdf",
                        date: new Date(),
                        allPages: true,
                        avoidLinks: true,
                        template: $("#page-template").html(),
                        paperSize: ["525mm", "355mm"],
                        margin: {
                            top: "4.5cm",
                            left: "1cm",
                            right: "1cm",
                            bottom: "2cm",
                        },
                        landscape: true,
                        repeatHeaders: true,
                        scale: 1,
                    }, 

需要说明的是:指定 charset = UTF-8 的元标记已包含在源代码中。

标签: javascriptjquerykendo-uipdf-generation

解决方案


推荐阅读