如何设置打印上边距 [英] how do I set Top margin of Print

查看:104
本文介绍了如何设置打印上边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生,



我正在使用Java Script进行打印。它是...

Dear Sir,

I am using Java Script to print. It is ...

function printPartOfPage(elementId)
    {
     var printContent = document.getElementById(elementId);
     var windowUrl = 'about:blank';
     var uniqueName = new Date();
     var windowName = 'Print' + uniqueName.getTime();
     var printWindow = window.open(windowUrl, windowName,
    'left=0,top=0,width=725,height=950');

     printWindow.document.write(printContent.innerHTML);
     printWindow.document.close();
     printWindow.focus();
     printWindow.print();
     printWindow.close();
    }



我需要设置最高保证金。请建议如何设置保证金。


I require to set Top Margin. Please suggest how do I set margin.

推荐答案

请阅读我对该问题的评论。



我建议使用 PrintDocument [ ^ ]上课。它更灵活,可以设置 PrinterSettings [ ^ ];)
Please, read my comment to the question.

I would suggest to use PrintDocument[^] class. It is more flexible and enable to set PrinterSettings[^] ;)


您必须使用CSS为打印添加任何边距。
You have to use CSS for adding any margin for printing purposes.


这篇关于如何设置打印上边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆