Save a generated PDF file using php

Last updated 2 years, 4 months ago | 328 views 75     5

Tags:- PHP

PHP | Download pdf file

To download a pdf file in PHP, we need to use the header() function. In the header() function, we need to pass "Content-Disposition" which is used to supply a recommended filename and force the browser to display the save dialog box


// It will be called downloaded.pdf

// The PDF source is in original.pdf



Note: There is a bug in Microsoft IE 5.5 that prevents this from working. The bug can be resolved by upgrading to Service Pack 2 or later.