HTML - Printing a repeating background image.
HTML - Printing a repeating background image.
Author
Discussion

The Griffalo

Original Poster:

72,863 posts

270 months

Wednesday 24th October 2007
quotequote all
I thought I was being really clever.... I can now tell if a report in my database has been printed and display a repeating background image if it has... Woohoo. Except of course browsers don't print background images by default. Arse. How can I get round this?

Snippet of how I'm doing it below.

{{{
<table width="832" border="1" cellpadding="0" cellspacing="0" <?php if ($Printed=="Yes&quotwink { ?>background="images/duplicate.gif" <?php } ?>>
<tr>
<td width="504" colspan="3"><p> Site: <strong><?php echo $row_PermitRecordset['Site']; ?></strong></p></td></table>
}}}

judas

6,252 posts

290 months

Wednesday 24th October 2007
quotequote all
It's a browser issue - unless background printing is enabled on the browser I don't think you'll get very far frown Something I've had to explain to clients a number of times.

idea I suppose you could you some CGI component to render the content as a graphic and stick a background in that way.

Probably best to think of an alternative way of flagging the content without needing background images.

The Griffalo

Original Poster:

72,863 posts

270 months

Wednesday 24th October 2007
quotequote all
Hang about.... I've got a content renderer running anyway to print my barcode on the footer...

Top ideabiggrin

The Griffalo

Original Poster:

72,863 posts

270 months

Wednesday 24th October 2007
quotequote all
But just in case that doesn't work does anyone have any other ideas?

I need to somehow make it very difficult (read impossible) to alter the master document or print a duplicate without it being obvious that it's not the original. A repeating watermark would be the ideal solution to make image manipulation difficult.

Any ideas or suggestions welcome.

RameshUK

595 posts

293 months

Wednesday 24th October 2007
quotequote all
Maybe use an if / then condition to pass a different stylesheet for printing ?


The Griffalo

Original Poster:

72,863 posts

270 months

Wednesday 24th October 2007
quotequote all
I've got my if/then processing working (it's how I switch the background image on second time it prints) but what could I do on the CSS that would allow me to identify a duplicate and make copying/editing very hard?

RameshUK

595 posts

293 months

Wednesday 24th October 2007
quotequote all
Had a quick look on google. Nothing useful I'm afraid.

Best bet would be to put a header on the page (with a copyright notice)instead of a background image.
It's easy to spend a lot of time trying to stop people copying,
but they will always find clever ways around it.

Good luck mate !

jagnet

4,442 posts

233 months

Thursday 25th October 2007
quotequote all
The Griffalo said:
I've got my if/then processing working (it's how I switch the background image on second time it prints) but what could I do on the CSS that would allow me to identify a duplicate and make copying/editing very hard?
You could always place the "master" image in the document as an embedded <img>, then use CSS to show/hide (display:none) the image depending on whether it's the master or copy document.

Bear in mind though that CSS and HTML can always be manipulated from within the browser.

Edited by jagnet on Thursday 25th October 09:23


Edited by jagnet on Thursday 25th October 09:25

The Griffalo

Original Poster:

72,863 posts

270 months

Thursday 25th October 2007
quotequote all
That sounds like a bloody good idea... While it could be manipulated I've shown due diligence if I can get it to print a watermark on anything but the first copy. If a user prints the document I capture the event with the onbeforeprint() event and throw an entry in my audit log so I can always tell how many copies of the document have been queued to print.

jagnet

4,442 posts

233 months

Thursday 25th October 2007
quotequote all
The Griffalo said:
That sounds like a bloody good idea... While it could be manipulated I've shown due diligence if I can get it to print a watermark on anything but the first copy. If a user prints the document I capture the event with the onbeforeprint() event and throw an entry in my audit log so I can always tell how many copies of the document have been queued to print.
That sounds like it should do the job then. I assume that this document is only going to be printed by Internet Explorer users? IIRC onbeforeprint() is only supported by IE.

The Griffalo

Original Poster:

72,863 posts

270 months

Thursday 25th October 2007
quotequote all
jagnet said:
The Griffalo said:
That sounds like a bloody good idea... While it could be manipulated I've shown due diligence if I can get it to print a watermark on anything but the first copy. If a user prints the document I capture the event with the onbeforeprint() event and throw an entry in my audit log so I can always tell how many copies of the document have been queued to print.
That sounds like it should do the job then. I assume that this document is only going to be printed by Internet Explorer users? IIRC onbeforeprint() is only supported by IE.
Yup, I redirect other browsers to an "unsupported" page and don't even let them log on.

RameshUK

595 posts

293 months

Thursday 25th October 2007
quotequote all
FYI:

http://www.w3schools.com/browsers/browsers_stats.a...

Shows Firefox (FF) as having 35.4% of the market !


The Griffalo

Original Poster:

72,863 posts

270 months

Friday 26th October 2007
quotequote all
Don't get me wrong, I prefer FF but this is on a secure internal network and the only browser officially in use is IE.

If I was developing something for general consumption I'd find a different workaround on the print logging thing.

Now, about this embedded <img> thing smile