Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Uncaught TCPdiParserException #65

Open
plysystems opened this issue Feb 22, 2023 · 0 comments
Open

Fatal error: Uncaught TCPdiParserException #65

plysystems opened this issue Feb 22, 2023 · 0 comments

Comments

@plysystems
Copy link

plysystems commented Feb 22, 2023

I got the following error:

Uncaught TCPdiParserException: Empty PDF data. in D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\tcpdf\tcpdi_parser.php:1425 Stack trace: #0 D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\tcpdf\tcpdi_parser.php(203): tcpdi_parser->Error('Empty PDF data.') #1 D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\tcpdf\tcpdi.php(121): tcpdi_parser->__construct(false, 'lib/temp/', 'exception') #2 D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\tcpdf\tcpdi.php(88): TCPDI->_getPdfParser('lib/temp/') #3 D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\PDFMerger.php(97): TCPDI->setSourceFile('lib/temp/') #4 D:\Programme\laragon\www\projects\Name Of Project\tools\public\pages\pdfmerge.php(21): PDFMerger\PDFMerger->merge('browser', 'lib/temp/Test.p...') #5 D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\system.php(53): include('D:\Programme\la...') #6 D:\Programme\laragon\www\projects\Name Of Project\tools\index.php(18): sys::view('pdfmerge') #7 {main} thrown in D:\Programme\laragon\www\projects\Name Of Project\tools\lib\classes\tcpdf\tcpdi_parser.php on line 1425

My Code:

if (!empty($_FILES['file_name']['name'][0])){
        $file_ary   = tool::reArrayFiles($_FILES['file_name']);
        $pdf        = new \PDFMerger\PDFMerger;
        $uploadTo   = "lib/temp/"; 
        $filename   = $uploadTo.basename($_POST['doc_name'].'.pdf');

        foreach ($file_ary  as $file) {
            $basename       = basename($file["name"]);
            $originalPath   = $uploadTo.$basename; 
            $tempPath       = $file["tmp_name"];
            if(move_uploaded_file($tempPath,$originalPath)){
                $pdf->addPDF($uploadTo.$filex, 'ALL');
            }
        }

        $pdf->merge('browser', $filename);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant