2

我正在使用以下功能打印 div 文档,它有一些动态生成的 css 显示在预览中,但在打印后,它显示的是内容而不是 css。请帮我 。

函数 PrintPDF(elem) { Popupnew($(elem).html()); }

function Popupnew(data) 
{
    var mywindow = window.open("", "mydiv", "height=400,width=600");
    mywindow.document.write("<html><head><title>Annotated Document</title>");
    mywindow.document.write("<link href='{{asset('bundles/acmeregister/css/style.css') }}' media='print,screen' rel='stylesheet' type='text/css'>\n");
    //mywindow.document.write('<script type="text/javascript" media="print,screen" src="bundles/acmeregister/importance/rangy-cssclassapplier.js">');
//mywindow.document.write('<script type="text/javascript" media="print,screen" src="bundles/acmeregister/importance/rangy-highlighter.js">');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');

    mywindow.print();
    mywindow.close();

    return true;
}
4

0 回答 0