Forum Moderators: coopster
I've used fpdf for some really simple server-side pdf creation, but this is going to need something more robust.
Can anyone with exerpience with doing this give me some idea of how complex this will be? Advantages to using rtf or pdf?
Many thanks for all input!
if you follow my meaning? that worked really well actually :-) I could do all the pretty formatting that words allows, then add on dynamic content generation/addition - and what's more it left it in a very commonly readable format (rtf), which could be edited by the end user using MS Word :-)
What you're describing is a perfect solution to what I need to do! So as I understand it, you can do all the fancy page layout (well, not *that* fancy) in Word, and then just dig open the file up dynamically and change the few values and then serve it up?
Sounds great.
//load the rtf
$source = fopen("source.rtf", "r");
$text = fread($source, fileSize("source.rtf"));
fclose($source);
//quick function for filling in values
function fillin($field,$value,$thetext)
{
return preg_replace("/[\$]$field/",$value,$thetext);
}
//use the function as many times as needed
$text=fillin("client_name",$client_name,$text);
//output the rtf again
header("HTTP/1.1 200 OK");
header("Content-type: application/rtf");
header("Content-length: ".strlen($text));
print ($text);
note the above fillin function is designed for where you have put in the original rtf document fields denoted by $, e.g. $client_name
I had a few small rounded corner gifs, and was experimenting with colour schemes. So I saved a few copies with different colours, opened the files (only around 100 or so byteS) checked where the color was, jsut a 3 byte bit, and then used s ingle image and dynamically changed colours to fit the CSS colours settings.
SN