아래의 코드를 실행 한 후에도 브라우저 PDF 출력과 함께 PDF 다운로드가 표시되지 않습니다. 빈 페이지 표시.PHPExcel PDF Writer가 작동하지 않습니다.
require_once 'Classes/PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setCellValue('c9','40');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
//You need to include and print to PDF the entire worksheets contained in the workbook
$objWriter->writeAllSheets();
//You need to assign a filename to the PDF file (write.pdf for example)
header('Content-type:Application/pdf');
header('Content-Disposition: attachment;filename="export.pdf"');
$objWriter->save('php://output');
여전히 코드에는 약간의 실수가 있습니다. 브라우저에서 PDF를 보는 동안 다운로드 할 수 없습니다. 첨부 된 스크린 샷을 찾으십시오.
마지막으로 당신은 파일에 PDF를 작성하는 문제를
헤더 ('콘텐츠 유형을 : 응용 프로그램/pdf '); 이것을 설정하고 write.pdf를 다운로드하는 대신에 – Satya
이 작동하는지 확인하십시오. sample.php가 다운로드 중입니다. 빈 웹 페이지를 브라우저에 표시합니다. – Bharanikumar
PHPExcel에서 사용중인 PDF 렌더링 라이브러리를 식별하고 있습니까? 나는 그 어떤 코드도 보지 않았기 때문에! –