[http:// localhost:8080 / jasperserver / flow.html?_ flowId = viewReportFlow& reportUnit = / reports / Custom / Jobs_Report& j_username = imtiaz& j_password = imtiaz& viewAsDashboardFrame = true& output = pdf]此网址生成PDF文件。现在我想通过PHP创建一个应用程序,它可以下载生成的PDF文件。
答案 0 :(得分:0)
$url = 'http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Custom/Jobs_Report&j_username=imtiaz&j_password=imtiaz&viewAsDashboardFrame=true&output=pdf';
$pdf_data = file_get_contents($url);
file_put_contents(uniqid().'_download.pdf',$pdf_data);
EDITED: 如果您需要下载弹出对话框,则需要添加pdf标题
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename='downloaded.pdf'");