Question

I want to remove URL from page at printing time with PHP is there any way to do this? Actually I don't want to push my clients to change their browser's settings at printing time.

Any help really appreciated!

Was it helpful?

Solution

That is a browser setting, unfortunately you can't change it and it sucks.

Only workaround that I can think of is that you serve PDF file which could be displayed inline if user has PDF plugins installed. In that case you have full control of content and user can print it.

OTHER TIPS

No. As per my knowledge.

The web-page url that gets displayed while printing a web page is a feature added by a broswers, and hence it can't be done through php as it is completely server-side scripting.

Also, I guess this can't be done using javascript, as said before "This is a feature of browsers" and javascript can be used to manilulate the dom of the page only.

I guess you cant do such thing.

You cant change in browser defaults like printer settings, margins, or any other browser setting, temporarily or permanently, from CSS or JavaScript.

There is a @page directive in css that enables some formatting that applies only to paged media (like paper). Refer link. But problem is this does not work in Firefox, Google Chrome, but it works in IE 8 and Opera 10.

Programmatically, you can't control this and it does suck. There are options that control this are part of the specific browser. Therefore, each user would have to change their browser settings to remove the URL from printing. Unfortunate, I know, but the browsers don't let you have that much control over them. One way to get around this is to generate a PDF document for printing. Any document that is downloaded and printed from the client machine rather than from within the browser will not have this problem.

Also, you may have a look at Prevent Firefox or Internet Explorer from Printing the URL on Every Page

Change Firefox setting Go to file->page setup -> Margins Header & Footer and set --blank-- what you need.

See more here

Maybe you can try to use CSS properties like "@page", "@top-left", ...

For example:

@page {
  @top-left {
    content: "";
  }
}

I found this example on W3C website : http://www.w3.org/TR/css3-page/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top