Print specific HTML

Is it possible to display markup for a printer that is not actually embedded on the page?

The problem is that I have a Flash application that displays dynamic data from the backend in such a way that it is actually not print friendly, but the client also wants to have a print version with raw data. I can easily output such content with a simple PHP page request, but the problem is that it needs to be sent to the printer when the user invokes printing.

The only way to create a custom print button and require the user to click it (instead of the browser print function), then load the PHP page in a new window and print this page? Or can I effectively override the HTML content that is sent to the printer, in the same way, can I override the CSS with the media attribute?

+3
source share
2 answers

The HTML document sent to the printer must be the same as the one sent to the browser. A special print version, you think, is one of the common ways to implement this behavior.

CSS : HTML-, . , , SWF, ( , ), . , Flash Javascript , HTML, , , , . , , .

. Javascript + CSS , , , .

+1

content :before .

HTML:

<div id="justForPrint"></div>

CSS

#justForPrint {
    display: none
}

@media print {
    #justForPrint {
        display: block
    }
    #justForPrint:before {
        content: "test data, test data, test data, test data, test data, test data, test data, test data, test data, test data, test data"
    }
}
0

All Articles