SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Printer Friendly Pages?

    Hi Everyone,

    If a webmaster makes "printer friendly pages" for there visitors would it be possible to know when a visitor actually prints a certain page using PHP?

    For example,
    Visitor A

    visits
    mywebsite.com/trucks/ford/f-150

    then visitor A prints the above page. Can PHP somehow recognize that page was printed? or is that not possible?

    Thanks Everyone

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,604
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    PHP has nothing to do with printing.

    Creating the printer friendly version of a web page is done using CSS. Everything except the CSS will be the same for the screen and print versions of the page with the media attribute determining which CSS to use.

    Just because someone visits the page doesn't mean they are going to print it and there is no way to tell from within the web page whether your visitor does or doesn't select to print the page as there is nothing changed within the page when they decide to print it.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    925
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    A partial solution would be to prodvide a print button that will lead to the pdf version of the page for printing, then you could at least track each pdf download - not really 100% the act of printing but at least an intention to print. But pdf's are not practical for normal web pages, they are more suited when a certain strict page layout on paper is required like bank statements, reports, etc. And as felgall said, you will not be able to tell if someone prints the page using File->Print - well, you could disable this way of printing using print css (some display: none, etc.) so that the only way is pdf but that would be kind of user-unfriendly.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •