I'm in the beginning phases of developing a website. I want to be able to limit the amount of printing of web pages of circulars. These will be in an image format and usually consist of between 2 and 16 web pages. The circulars change each week.

Is there a way to limit the user to only 1 or X number of prints for each page and for each week? Is this easier done with standard web development or can it be done even easier in a content management system such as WordPress?

asdfghjklasdfgh commented: bad question... +0

If a client can view your content, the client can "print" as many as the client wants. You may try to disable the "print" functionality on your display but that does NOT stop those who can manipulate with your display page (i.e. using plug-in) to enable the functionality, or even using screen capturing. You could, however, limit the number of viewing your content but that may break what you want to do...

Thanks Taywin for the response. So basically I could allow them to see the circular one time a week and, at that time, they can print how often they want to, but will not be allowed to come back to the page after the one visit?

What would you consider the best way of completing that task?

but will not be allowed to come back to the page after the one visit?

I dont see how you are going to do that without authenticating and tracking the user.

Without authentication (forcing them to log on so that you know their identity), you could attempt to drop a cookie on their machine, but that wouldnt track the user. They could clear their browser cache and/or use a different browser/different computer.

If you authenticate them, you can track in a database, when the last visit was and what pages were viewed (loaded). Based on that info, you would make a decision whether or not to show the page.

This all requires server side scripting of course.

As JorgeM said, you need to be able to identify your client (who is viewing) and it is controlled by the back end (server side). The only ensure way to know who is viewing your page is to use authentication (log in). If you do not use the log in, you may use IP address but that has side effects -- not allow viewing from different computers that are on the same network or does not prevent dynamic IP. Do you have a control on the server side? If not, I am guessing you won't be able to control the viewing.

I don't think you can do this with a browser.

I don't think you can do this with a browser.

We'll see... I am actually kind of curious to know more about this question as well. This is something I haven't thought about.

But here is an answer from another forum that the OP has asked the same question in:

Not unless you have full control over the client-side.

You can TRY to prevent that SAME computer (via cookie) from navigating to the same page twice.

If you are giving the user a unique ID to access the circular pages, you can mark that ID as already having displayed the pages.

But there is simply no way to make sure that the user can't call the print calls in the browser.

One trick, which a js hacker could easily get around.. tie into the page printed event. The answers to that question talk about just how poorly the events are supported, and not cross-browser. If this browser has already had that event fire, nav away or change the @media rule for printing to return css making the whole page display:none (or some trickery).

As far as the actual print dialog ("Copies: x"), there's nothing you can do.

Thank you everyone for your replies. I do have server-side access and apologize for the confusion. I'm not asking how to do that from the DOM level per say, but simply any possible way to do it.

The login option that JorgeM mentions is a possibility. My fear is having those extra steps will confuse many and detract others. Although, if that's the only way to go about handling the issue, then that's the way it will have to be.

I know that sites like coupons.com and petsmart.com have this ability. It's just that I'm not sure how in depth the code is and I definitely do not want to infringe on any code and have the copyright trolls come knocking.

I'm really not worried about the experienced hacker printing multiple copies because it will be visited mostly by novice Internet users (or at least that's the demographic). After all, I do understand that if someone really wants to get in and print multiple copies and they have the skills to do it, not much I can do to stop it.

@</M> Yes, I asked this same question into other forums because I knew not everyone follows the same forums that I do and was hoping to get a very quick response. Is this bad form?

because it will be visited mostly by novice Internet users (

For the most novice users, dropping a cookie on their computer would be the easiest approach without having to implment a login system. Of course, as soon as the user clear's their cache, the cookie will be removed.

On your server side code, when you detect this cookie, you read the value stored in the cookie and if the user has visited/printed then you redirect the user to a message letting them know they have already seen/accessed the page.

Thanks JorgeM. I don't have a ton of experience writing cookies. Is there a way I can set the expiration date of the cookie for a certain day of the week? For example, the cookie expires every Wednesday at 0:00 (12:00 am).

Yes, you can specify a certain expiry date on the cookie. You can create cookies using javascript (client side) or server-side (PHP, asp.net, etc..)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.