Print with specific dimensions of a page?

Hi all,
How to write a function to call a print dialog, and that allows only the specific part(means specific width and height) of the page…

This function is called by clicking on the custom print button on the web page…

How to write this in php?

Can any one help me regarding this…

You can’t write it in PHP. PHP is executed on the server side. Printing happens in the browser — client side.

JavaScript is executed on the client side and you can open the Print dialog using JS but as far as I know it doesn’t allow any customisation.

then how can i solve this problem?

Actually, i want to print some portion of the page.

You can use CSS to hide portions of the page you don’t want printed:

For example:


@media print {
    #header, #footer { display: none }
}