@dwr0218 (dwr 0218)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

TCPDFをXserver上で実行した際、iosだけ壊れたPDFが生成される

解決したいこと

iosでもPDFを生成したい

phpで予約システムを作成しており、ボタンを押したらPDFが作成されるシステムがあるのですが、
iosで生成されたPDFを開こうとすると壊れたPDFとでます。
android,pcで生成されたものは開けます。
edge、chrome、safari全てで同様です。
そのファイルをPCに移して表示しても同じで開けません。
原因がわからないので、教えて頂ければ幸いです。

発生している問題・エラー

TCPDFをXserver上で実行した際、iosだけ壊れたPDFが生成される

該当するソースコード

<?php
require_once('tcpdf/TCPDF-main/tcpdf.php');
require_once('tcpdf/TCPDF-main/autoload.php');
class MYPDF
{
    function pdf1($day)
    {
        try {

            $pdf = new setasign\Fpdi\Tcpdf\Fpdi();
            $pdf->setPrintHeader(false);

            $files =
                './PDF/技能教育/受講申込書.pdf';

            $pdf->setSourceFile($files);
            $pdf->addPage();
            $pdf->useTemplate($pdf->importPage(1));

            ob_end_clean(); 
            $pdf->Output(sprintf("application_%s.pdf", time()), 'D');
            exit;
        } catch (Exception $ex) {
                header("Location:./stsys06.php");
            exit;
        }
    }
}

0 likes

No Answers yet.

Your answer might help someone💌