0

Can I configure this function to make it print a certain pixel only?
Around 500px X 700px Center.

<script language="javascript">
... function printpage()
{
window.print();
}
</script>

Is it possible?

Edited by Dani: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Airshow
0

Can I configure this function to make it print a certain pixel only?
Around 500px X 700px Center.

<script language="javascript">
... function printpage()
{
window.print();
}
</script>

Is it possible?

Yes but only if your "certain pixel" is addressable with a CSS selector, in which case you can set a CSS @media rule to hide everything else, eg.:

@media print {
    * { display: none; }/* or visibility: hidden */
    #myPixel { display: inline; }
}

A pixel rendered as part of more extensive contents of an HTML element is non-addressable with CSS and the @media method cannot be used.

A possible alternative, if you know exactly where the pixel is on the page in absolute terms, would be to mask out everything else with a set divs with opaque white backgrounds leaving your single pixel showing through a 1px x 1px gap. The masks could be constructed/managed with javascript.

Airshow

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.