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



Reply via email to