Thanks, I had something similar in mind.  The reason I was hoping to use RTF
is so the customer can easily create new documents and be able to fill in
the variable data themselves. 

Example.  First Name: $fname 

So they would actually type the PHP variable and I could easily read in the
RTF file from database.  

As much as I appreciate everones suggestions thus far, nobody has yet to
address the issue of actually printing the data.  I have no need to save
and/or display the form, I only need to send it to the server side printer
(optionally client side as well, if possible).  It's looking as if I will
have to parse through the RTF and convert it to the built in PHP printer
functions, but I feel this is ineffecient and therefore not necessarily the
best solution.


Thanks to everyone so far!!

-----Original Message-----
From: Justin French [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 20, 2004 10:04 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Printing invoices

On 21/06/2004, at 9:30 AM, bskolb wrote:

> Could someone direct me to a printing solution from a static document 
> that would render variable data elements to be sent to a printer 
> queue?  I was thing perhaps of an RTF for the static page, but can't 
> seem to locate any way of inserting the variable data, then spit out 
> each occurrance to a printer.

You could read the contents of an RTF file straight into a PHP variable,
then perform some regular expressions on it.  You'd have to set-up some
naming conventions, but replacing something like {FIRSTNAME} with the
contents of $myInvoiceData['FIRSTNAME'] would be pretty basic stuff.  I'd
probably use preg_replace_callback() with a callback to a function which:

a) attempts to match {THIS_BIT} with $myInvoiceData['THIS_BIT']
b) if no match, either
        - return nothing (it replaces {THIS_BIT} with nothing), or
        - return {THIS_BIT} (no replacing done -- probably safer for
debugging and the mysteries of RTF.
c) if there's a match return the value of $myInvoiceData['THIS_BIT'],
replacing {THIS_BIT}


Let me know if you need more help, but
http://php.net/preg_replace_callback should give you enough pointers.


---
Justin French
http://indent.com.au

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to