Hi, Thanks for the reply.
I don't know much about coding. I used joomla for my site. Whatever the codes there, created by joomla 3.0. I tried many ways as you suggest me. I couldn't sort it out, actually.
One of the example from chronoform component, allows me to print out exactly as I need - but unfortunately it works with normal web page view. When I click on 'Print' button, it pops-up a HTML webpage window only with my data, and on top of that print windows comes to allow printing. And that's working with window.open() function. That's why, I tried to have that function to work, which doesn't work when I tried with lightbox.
There is one print.css file in my template folder. But even if I remove that, my printing still works fine as it is. I am actually not clear which file, where to put, what to edit. That's the problem. For you to understand, I have added my code. It works, when I click 'Print' button in normal view. But when I call lightbox, then doesn't. Please have a check, and let me know, where I may need to change and what.
PHP Code:
<input type="button" value="Print" id='print_button' style='visibility: visible;'></input>
<?php
$doc =JFactory::getDocument();
$script = "
function printPage()
{
var html, css, csss_file, printWin;
css = \"\";
css = \"<style type='text/css'>\"+css+\"</style>\";
css_url = '';
if ( css_url !== '' ) {
css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";
}
html = '<html><head>'+css+css_url+'</head>'+$(id).innerHTML+'</html>';
printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=no, scrollbars=yes, status=yes' );
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
}
var id;
window.addEvent('domready', function() {
id = 'print_div';
$('print_button').setStyle('visibility', 'visible');
$('print_button').addEvent('click', printPage);
});
";
$doc->addScriptDeclaration($script);
?>
Thanks a lot.
Bookmarks