[Wolves] php generated text over image or rewrite entire doc?

Andy D'Arcy Jewell andy.jewell at sysmicro.co.uk
Wed Jun 20 11:45:49 UTC 2012


On 20/06/12 11:48, Jon Farmer wrote:
<snip>
> About 10 years ago I faced a similar challenge with a supplier order
> document which had to be submitted as a MS Word doc. We obviously didn't
> want to key in the data to our CRM then again into the .doc.
>
> So I saved the .doc as Rich Text format. Added tags into the relevant
> fields on the document such as <first name>. Then used a bit of Perl to
> open the RTF file, connect to DB, replace the tags with the data, save
> the file as a RTF with a .doc extension and then email it to the supplier.
>
> It 'Just Worked' as the MS Word opened the .doc even though it was
> actually RTF and the supplier was non the wiser.
>
> This approach might work but as a download-able '.doc' rather than email.
>
An alternative approach might be to layer a transparent GIF or PNG, containing the text fields, generated with ImageMagick on top of your "blank" image. You could cache the overlay images (perhaps permanently) so you don't have to keep regenerating them. If you use a compressed, low bit density, monochrome image (say 256 colours) it should provide enough shades to make anti-aliasing look nice, but keep your image size as low as possible. It's also quite easy to create a PDF from an image, and ImageMagick can do a merge operation, I believe.


-- 
Andy D'Arcy Jewell

SysMicro Limited
Linux Support
T:  0844 9918804
M:  07961605631
E:  andy.jewell at sysmicro.co.uk
W:  www.sysmicro.co.uk




More information about the Wolves mailing list