dank
06-27-2002, 01:03 AM
This question could fit a few different forums, depending on the method taken to tackle the problem. Ok, here's the situation (said in my best Will Smith voice) :
I've got a PHP script that outputs a coupon, the idea being that it can be printed off and taken to wherever it's intended to be used. I figured I'd pretty it up a bit by adding a dashed line (long dash, short dash) around the perimeter, accomplished by using a repeating graphic as table backgrounds within outer cells. Looks good on screen, but the dashed lines don't print... I've seen this with other repeating graphics, such as page backgrounds and certain stretched images. Seems printers ignore them. If anyone can think of a way around that, then this becomes an HTML question, not a PHP one...
I could resort to using a single, non-repeating image of a fixed size for each edge of the dashed line, but that would rely on the text and graphics within the coupon not exceeding a maximum size (risky considering the difficulty in ensuring font sizes from one browser to the next).
So, I'm thinking something more dynamic might be in order, possibly PHP's GD or PDF libraries. I don't believe we have PDF support built-in on the FutureQuest servers, do we? It would be a dream come true if the GD functions (what's GD stand for, anyway?) allowed a way of reading file output into a graphic created on the fly, but it appears only existing images can be read in.
There is the imagesetstyle() (http://www.php.net/manual/en/function.imagesetstyle.php) function that can create dashed lines, so that might be a good starting point, albeit a rather complex one for the intended result. I'm still unsure of whether or not that would work, though. Wouldn't I still need to know the size of the resulting image in order to work with perimeter coordiantes for the lines? That would seem to require mapping out areas of the coupon that cannot be spilled over by text, but at least I could graphically ensure font consistency...
Any other suggestions? I could put an HTML snapshot of the coupon up on the server, if it would help people to see what I'm working with.
Dan
I've got a PHP script that outputs a coupon, the idea being that it can be printed off and taken to wherever it's intended to be used. I figured I'd pretty it up a bit by adding a dashed line (long dash, short dash) around the perimeter, accomplished by using a repeating graphic as table backgrounds within outer cells. Looks good on screen, but the dashed lines don't print... I've seen this with other repeating graphics, such as page backgrounds and certain stretched images. Seems printers ignore them. If anyone can think of a way around that, then this becomes an HTML question, not a PHP one...
I could resort to using a single, non-repeating image of a fixed size for each edge of the dashed line, but that would rely on the text and graphics within the coupon not exceeding a maximum size (risky considering the difficulty in ensuring font sizes from one browser to the next).
So, I'm thinking something more dynamic might be in order, possibly PHP's GD or PDF libraries. I don't believe we have PDF support built-in on the FutureQuest servers, do we? It would be a dream come true if the GD functions (what's GD stand for, anyway?) allowed a way of reading file output into a graphic created on the fly, but it appears only existing images can be read in.
There is the imagesetstyle() (http://www.php.net/manual/en/function.imagesetstyle.php) function that can create dashed lines, so that might be a good starting point, albeit a rather complex one for the intended result. I'm still unsure of whether or not that would work, though. Wouldn't I still need to know the size of the resulting image in order to work with perimeter coordiantes for the lines? That would seem to require mapping out areas of the coupon that cannot be spilled over by text, but at least I could graphically ensure font consistency...
Any other suggestions? I could put an HTML snapshot of the coupon up on the server, if it would help people to see what I'm working with.
Dan