Jump to content

[SOLVED] [function.fopen]: failed to open stream... i use HTML2PDF


opencombatclan

Recommended Posts

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.

<?
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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.