public function generatePdf(Collection $applicants, ClientSurvey $client_survey, ?DomainLanguages $locale = null, bool $include_extra_page_between_surveys = false): Response 	{ 		$folder_uuid = Str::orderedUuid(); 		$folder_path = storage_path('pdf') . '/' . $folder_uuid;  		try { 			$logos = $this->getLogoLinks($client_survey->survey_type);  			if ($client_survey->switch_basic_and_additional_question_order) { 				$merged_pdf_filename = 'offline_surveys_switched_' . str_replace(' ', '_', $client_survey->client->authParent?->name) . '.pdf'; 			} else { 				$merged_pdf_filename = 'offline_surveys_regular_' . str_replace(' ', '_', $client_survey->client->authParent?->name) . '.pdf'; 			}  			$view = $this->getPrintableViewName($client_survey->survey_type); 			$pdf = App::make('snappy.pdf.wrapper');  			$pdf_paths = []; 			$locale = $locale ? $locale->value : null;  			foreach ($applicants->chunk(50) as $applicants_chonkey) { 				$file_uuid = Str::orderedUuid(); 				$path = $folder_path . '/' . $file_uuid . '_split.pdf';  				$pdf 				->loadView($view, [ 					'client_survey' => $client_survey, 					'applicants' => $applicants_chonkey, 					'lang' => $locale, 					'logos' => $logos, 					'font_regular' => public_path('fonts/NimbusSans-Regular.ttf'), 					'font_italic' => public_path('fonts/NimbusSans-Italic.ttf'), 					'font_bold' => public_path('fonts/NimbusSans-Bold.ttf'), 					'font_bold_italic' => public_path('fonts/NimbusSans-BoldItalic.ttf'), 					'departments' => $client_survey->departments, 					'locations' => $client_survey->locations, 					'include_extra_page_between_surveys' => $include_extra_page_between_surveys, 					'include_demographic_questions' => $client_survey->include_demographic_questions, 					'switch_basic_and_additional_question_order' => $client_survey->switch_basic_and_additional_question_order, 					'demographic_first' => $client_survey->demographic_first, 					'departments_first' => $client_survey->departments_first, 					'locations_first' => $client_survey->locations_first, 				]) 				->setPaper('a4') 				->save($path);  				$pdf_paths[] = $path; 			}  			$pdf_merger = PDFMergerFacade::init();  			foreach ($pdf_paths as $pdf_path) { 				$pdf_merger->addPDF($pdf_path, 'all'); 			}  			$pdf_merger->setFileName($merged_pdf_filename); 			$pdf_merger->merge();  			File::deleteDirectory($folder_path);  			// @phpstan-ignore-next-line 			return $pdf_merger->download(); 		} catch (Exception $e) { 			File::deleteDirectory($folder_path);  			throw $e; 		} 	}