Page 1 of 1

File Output

Posted: Tue Jul 17, 2007 9:25 am
by icesolid
I am currently using HTML2PDF to generate dynamic PDFs on the fly.

Everything works smooth as far generating the PDF goes.

The only problem I am having is when I want to output that PDF file name it cannot have any spaces in the file name. So like if I needed to have "Joe Smith; CPP45746545" as the file name it would not work. But if I used "Joe_Smith_CPP45746545" the file would output successfully.

Here is the output code that I am using:

Code: Select all

<?php
$filename = $row["name_of_insured"] . "; " . $row["policy_number"];

$pdf->Output("$filename.pdf", "I");
?>
That output generates a unusable file. Not a valid PDF file because of the spaces. I am wondering why this won't work with spaces because you can put files on your server like "Joe Smith.mp3" and the file is accessible.

The "I" means open the file and if I replaced that "I" with a "D" it would mean download the file. I don't think that has anything to do with my problem here. Either way it does not work.

Posted: Tue Jul 17, 2007 9:36 am
by cent
try putting %20 instead of spaces. that should put spaces where you want them.