TCPDF返回奇怪的字符 [英] TCPDF returning weird characters

查看:109
本文介绍了TCPDF返回奇怪的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许您可以帮助我.当我尝试显示pdf时,我创建了一些类似这样的奇怪符号

maybe you can help me. When I try to show a pdf I created I got some weird symbols like this

u\>�'���O���r>c!%�@�R�`YPd+��vv����1��E�'^k-�WD�*+��W^��wy��V Z��dUdJ�B���C�ڳtK����j:c���5����50���D3lgH#�}%���D+������ix����,��-�'\�� �_st^&0�Y���������v�*Ӗ,W����u!H��sNN��0cӝ��`xEk��d��^� �8K9�BL����9�̋"6/�E�|�̛�-�7�P��B�#�T�F���4`����

我要做的是使用此代码转换html文件

What I do is transform a html file with this code

    $html = $this->load->view('ReporteIngresoView', $data, TRUE);
    $pdf = new Pdf('P', 'mm', 'A4', TRUE, 'UTF-8', FALSE);
    $pdf->SetTitle('Reporte ingreso');
    $pdf->SetHeaderMargin(30);
    $pdf->SetTopMargin(40);
    $pdf->setFooterMargin(20);
    $pdf->SetAutoPageBreak(TRUE);
    $pdf->SetAuthor('Pontificia Universidad Católica del Ecuador');
    $pdf->SetDisplayMode('real', 'default');
    $pdf->AddPage();
    $pdf->writeHTML($html, TRUE, 0, TRUE, 0);
    $pdf->Output('My-File-Name.pdf', 'I');  

另一方面,我会这样接受

On the other side I recieve it like this

Ext.Ajax.request
            (
                {
                    method: 'post',
                    url: '../servidor/archivo/ingreso/getreporte',
                    success: function(response){
                    Ext.getCmp('winReporteRegistro').update( response.responseText );
                       }
                    }
            );

我正在使用php(服务器),html(创建页面),extjs(界面),ajax(请求)和TCPDF创建pdf.

I am using php (server), html (create the page), extjs (interface), ajax (request) and TCPDF to create the pdf.

有什么想法吗?

预先感谢

推荐答案

返回文件的位置并在另一个网页中打开该文件就是答案,代码为:

Returning the location of the file and open that in another web page was the answer, the code is:

服务器:

$html = $this->load->view('ReporteCajaView', $data, TRUE);

    $pdf = new Pdf('P', 'mm', 'A4', TRUE, 'UTF-8', FALSE);
    $pdf->SetTitle('Reporte item');
    $pdf->SetHeaderMargin(30);
    $pdf->SetTopMargin(20);
    $pdf->setFooterMargin(20);
    $pdf->SetMargins(25, 20, 20, true);
    $pdf->SetAutoPageBreak(TRUE);
    $pdf->SetAuthor('Universidad Católica');
    $pdf->SetDisplayMode('real', 'default');
    $pdf->setPrintHeader(FALSE);
    $pdf->setPrintFooter(FALSE);
    $pdf->AddPage();

    $id = uniqid();
    $pdf->writeHTML($html, TRUE, 0, TRUE, 0);
    $pathservidor = 'c:/wamp64/www/Archivo/pdf/';
    $pdf->Output($pathservidor . 'Reporte de caja' . '.pdf', 'F');

    echo 'c:/wamp64/www/Archivo/pdf/'.'Reporte de caja'.'.pdf';

客户:

Ext.Ajax.request
            (
                {
                    method: 'post',
                    url: '../servidor/archivo/item/getreporte',

                    success: function(response){
                    window.open(response.responseText);

                       }
                }
            );

谢谢!

这篇关于TCPDF返回奇怪的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆