By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,864 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,864 IT Pros & Developers. It's quick & easy.

problem - generate dynamic PDF files on the server

P: n/a
I tried to use HTML2FPDF to generate dynamic local files and save the
generated files on the server. I don't know why it gives me the
following error message:

" Warning: fopen(gen_pdf/gen_pdf/yan.pdf) [function.fopen]: failed to
open stream: No such file or directory in
/export/home/.../pdfCov/fpdf.php on line 1698
FPDF error: Unable to create output file: gen_pdf/yan.pdf "

I cut and paste the following part of the code into a test.php file and
run it. the test file can generate text file without any problem:

$name="testfile.pdf";
$handle = file_exists('gen_pdf/'.$name);
if (!$handle)
{
$f = fopen('gen_pdf/'.$name,'x+');
}
if(!$f) $this->Error('Unable to create output file: '.$name);
fwrite ($f,"testtest");
//fwrite($f,$this->buffer,strlen($this->buffer)); //this line is in
fpdf.php to generate pdf contents

fclose($f)

Anyone can help me out?

Thanks!

Apr 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi

I don't know anything about the particular package you are using, but,
looking at your error message and code snippet, I'd guess that the
problem is that the gen_pdf/gen_pdf/ directory does not exist.
(Your testfile just goes to the gen_pdf/ directory, but the package
code appears to be trying to put the file in gen_pdf/gen_pdf/, and if
that sub-directory doesn't exist, you will get that kind of fopen
error.)

HTH

-Kurt

Apr 26 '06 #2

P: n/a
Hi, Kurt,

Thank you for your help.

It was a dumb mistake while I was trying to test in different ways.

I modified the code, but the same error message occurs:

Warning: fopen(gen_pdf/yan.pdf) [function.fopen]: failed to open
stream: No such file or directory in /export/home.../pdfCov/fpdf.php on
line 1698
FPDF error: Unable to create output file: yan.pdf

Any idea what is wrong?

Thanks!

Apr 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.