I am using the FPDF library for generating PDF files by PHP. This library is working fine with plain text(i.e PDF files are generating for any text), but this is giving me a
After a long struggle finally I found the reason for this issue which I've already discussed here.
Mainly this problem is due to the 'allow_url_fopen' setting which is not enabled for my server, I've solved this issue by using the CURL. I'm giving the step by step procedure to solve this issue because this may useful for somebody like me to avoid wastage of time(for finding the solution).
1. Create a temporary file in the local system with write permission. Ex: $fp = @fopen($local_file_path, 'x'); fclose($fp); 2. Get the remote location file contents using CURL and write that to local file which is created in the previous step. Ex: $curl = new CurlWrapper($remote_file_path); $curl->copyToFile($local_file_path); 3. Now send this local file path to FPDF function(image) then the corresponding PDF will get generate for the file without any issues.
I think this is one method to solve this issue, if anybody knows some other ways then you can post them here so that this question may be useful for somebody.
just add:
allow_url_fopen = ON
on php.ini (create new if not exists) solves the problem.
http://www.solo-technology.com/blog/2010/04/07/quick-fix-for-url-file-access-is-disabled-issues/