我有一个使用js打印设置的打印功能,一切运行良好并且工作正常,但我有一个问题让我感到困惑。这是关于字体样式,当我在Windows上打印时,字体是正确的,就像我在函数打印本身中设置的那样,但是当我在linux(ubuntu)上打印时,字体不像我之前设置的那样。我该怎么做才能解决这个问题?提前谢谢......
这是功能:
function load(){
var divElements = document.getElementById('areaCetak').innerHTML;
//var oldPage = document.body.innerHTML;
document.body.innerHTML =
"<html><head><title></title></head><body>" +
divElements +
"</body><style type='text/css' MEDIA='print'>@media print {.page-break{ display:block; page-break-after:always; } } body { color:#404040; font-family: Arial,sans-serif; font-size: 10px; padding: 0px 0px 0px 0px ; } table { font-family: Arial,sans-serif; font-size: 10px; padding: 0px 0px 0px 0px; border-collapse: collapse; } th, td { padding: 0; font-family: Arial,sans-serif; font-size: 10px; }</style>";
//jsPrintSetup.setPrinter('EPSON LX-310 ESC/P'); //
//jsPrintSetup.setPrinter('Epson-LX-300+-2');
jsPrintSetup.getPrinter();
jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
//jsPrintSetup.setSilentPrint(1);
//jsPrintSetup.printWindow(window);
jsPrintSetup.setOption('marginTop', 0);
jsPrintSetup.setOption('marginBottom', 0);
jsPrintSetup.setOption('marginLeft', 0);
jsPrintSetup.setOption('marginRight', 0);
jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '');
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
//jsPrintSetup.setSilentPrint(false);
jsPrintSetup.clearSilentPrint();
jsPrintSetup.setOption('printSilent', 1);
jsPrintSetup.print();
}