opencombatclan Posted August 18, 2008 Share Posted August 18, 2008 hi all, i set up a site and i liked to test HTML2PDF, because i need it for a very important project. But when i copied all files and made my test php and html files its not working! i get: Warning: fopen(doc.pdf) [function.fopen]: failed to open stream: Permission denied in /home/projects/domains/kunstnier.gethost.nl/public_html/phptest/fpdf.php on line 1687 FPDF error: Unable to create output file: doc.pdf the phpprint.php file contains: <? require('html2fpdf.php'); $pdf=new HTML2FPDF(); $pdf->AddPage(); $fp = fopen("test.html","r"); $strContent = fread($fp, filesize("test.html")); fclose($fp); $pdf->WriteHTML($strContent); $pdf->Output("doc.pdf"); echo "PDF file is generated successfully!"; ?> i tried to chmod everything thru ftp to 777, but without result. i tried html2fpdf-3.0.1b and html2fpdf-3.0.2b, both did not work. i have the file test.html in the same directory <html> <head> <title>test</title> </head> <body> <h1>TEST</h1> </body> </html> So why i get this error? please help me out. Link to comment https://forums.phpfreaks.com/topic/120182-solved-functionfopen-failed-to-open-stream-i-use-html2pdf/ Share on other sites More sharing options...
opencombatclan Posted August 18, 2008 Author Share Posted August 18, 2008 <? require("html2fpdf.php"); $htmlFile = "file.html"; $file = fopen($htmlFile,"r"); $size_of_file = filesize($htmlFile); $buffer = fread($file, $size_of_file); fclose($file); $pdf=new HTML2FPDF(); $pdf->AddPage(); $pdf->WriteHTML($buffer); $pdf->Output(); ?> did do the trick! Link to comment https://forums.phpfreaks.com/topic/120182-solved-functionfopen-failed-to-open-stream-i-use-html2pdf/#findComment-619175 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.