WinForm调用打印机及预览功能


 


private void button2_Click(object sender, EventArgs e){

    Spire.Pdf.PdfDocument pdfdocument = new Spire.Pdf.PdfDocument();
    pdfdocument.LoadFromFile(url);//文件路径地址
 
                        实现预览
           窗体上拉一个 PrintPreviewControl  控件
            doc.Preview(PrintPreviewControl);
        

     如需打印继续执行以下方法
    pdfdocument.PrintSettings.PrinterName = 打印机;//打印机名字
    pdfdocument.PrintSettings.Copies = 1;//指定打印的次数
    pdfdocument.PrintSettings.Collate = true; //是否被整理
    pdfdocument.PrintSettings.SetPaperMargins(0,0,0,0);
    pdfdocument.PrintSettings.PaperSize = new PaperSize("Letter", 3000, 1500);//纸张的大小
    pdfdocument.Print();
    pdfdocument.Dispose()

    }



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM