[http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Custom/Jobs_Report&j_username=imtiaz&j_password=imtiaz&viewAsDashboardFrame=true&output=pdf] This url generates PDF file. Now I want to make an application by PHP, which can download that generated PDF file.
Asked
Active
Viewed 1,946 times
0
-
`file_get_contents('http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Custom/Jobs_Report&j_username=imtiaz&j_password=imtiaz&viewAsDashboardFrame=true&output=pdf');` – Ja͢ck Feb 14 '13 at 04:27
-
I've tried this but it not shows the download pop window, I need that please. – Imtiaz Masrur Feb 14 '13 at 04:41
-
In that case, I would suggest setting up a proxy using Apache. – Ja͢ck Feb 14 '13 at 04:43
-
Here I got the solution. Please see this link [http://stackoverflow.com/questions/6516902/how-to-get-response-using-curl-in-php][1] [1]: http://stackoverflow.com/questions/6516902/how-to-get-response-using-curl-in-php – Imtiaz Masrur Feb 18 '13 at 04:24
1 Answers
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: if you need download popup dialog you need to add pdf header
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename='downloaded.pdf'");

Rajesh R
- 125
- 7