954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

window.print() question

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

CODE][/CODE]

Is it possible?

rakwel10
Junior Poster in Training
68 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

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

CODE][/CODE]

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

Airshow
WiFi Lounge Lizard
Moderator
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: