Created
December 13, 2015 07:16
-
-
Save nixon1333/bd41b34e8174115eb08c to your computer and use it in GitHub Desktop.
how to parse a secured file in php and make it available in pdf using wkhtmltopdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//if expected template available in string formate | |
if($string1) | |
{ | |
//write the expected template in a unique html file | |
write_file("uploads/$classId/Result-$classId-part$number.html", $string1); | |
//make the unique url for the html | |
$fileUrl = base_url()."uploads/$classId/Result-$classId-part$number.html"; | |
//run exec funtion and fee the html link to wkhtml function with requed pdf link(unique) | |
exec('"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" '.$fileUrl. ' uploads/'.$classId.'/'.$number.".pdf"); | |
//after execution remove the html file | |
unlink("uploads/$classId/Result-$classId-part$number.html"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment