Dark_Knight
Dark_Knight

Reputation: 41

TCPDF UTF-8 Japanese File Name Not Showing up

I try to make a report with tcpdf but it's not working with utf-8 (Japanese) . (PHP language).

PDF::SetTitle('Cat Report');
    PDF::SetSubject('Dog Report');
    // PDF::SetFont('kozgopromedium', '', 12);
    PDF::SetFont('dejavusans', '', 12);
    PDF::AddPage();
    PDF::writeHTML($html_header_style . $html, true, false, true, false, '');
    $pdfFileName = "園児コード";

    PDF::Output($pdfFileName . '.pdf','D');

But output file name is: .pdf. I cannot open this file. Japanese file name is not showing up

Any help would be appreciated.

Upvotes: 0

Views: 1563

Answers (2)

Dark_Knight
Dark_Knight

Reputation: 41

I resolved this.

In 'tcpdf.php' file: i was comment from line 7559 to 7562

public function Output($name='doc.pdf', $dest='I') {
    ...
    //if ($dest[0] != 'F') {
        //$name = preg_replace('/[\s]+/', '_', $name);
        //$name = preg_replace('/[^a-zA-Z0-9_\.-]/', '', $name);
    //}
    ...
}

Reference library doc: tcpdf

Upvotes: 4

Tung Do
Tung Do

Reputation: 11

Try:

PDF::Output($pdfFileName . '.pdf','FD');

Upvotes: 1

Related Questions