2

I'm using amazon s3 pdf links to merge multiple file into single files.The code is working fine on local and generates single merged file .But on live its giving this error "Unable to find object (2, 0) at expected location."

         $mpdf = new \Mpdf\Mpdf();
                    $mpdf->SetImportUse();

                    if(!\File::isDirectory(public_path('media'))) {

                        \File::makeDirectory(public_path('media'), 0777, true, true);
                    }
                    foreach ($fileData as $media){
                        $file_content = file_get_contents($media['link']);

                        $file_name =time() . '.' . 'pdf';

                        file_put_contents(public_path('media/').$file_name,$file_content);
                        $pagecount = $mpdf->SetSourceFile(public_path('media/').$file_name, \Mpdf\Output\Destination::STRING_RETURN);
                        for ($i = 1; $i <= $pagecount; $i++) {
                            $mpdf->AddPage();
                            $import_page = $mpdf->ImportPage($i);
                            $mpdf->UseTemplate($import_page,10, 10, 200);
                        }
                    }
                    $pdf_file_name = time().'merged.pdf';

                    $mpdf->Output(public_path('media/').$pdf_file_name, 'f');
                    $path =public_path('media/').$pdf_file_name;
                    return response()->json(['status' => true, 'message' => __('File merged Successfully '), 'data' => $path]);
nouman
  • 108
  • 1
  • 1
  • 9

0 Answers0