前面我们介绍了如何使用spire.presentation 提供的 ,该文将详细介绍如何使用printersettings 对象打印幻灯片文档并进行打印设置。
首先请查看microsoft powerpoint打印设置:
c#
static void main(string[] args)
{
//加载示例文档
presentation ppt = new presentation();
ppt.loadfromfile("sample.pptx");
//使用 printersettings 对象打印幻灯片
printersettings ps = new printersettings();
ps.printrange = printrange.allpages;
ps.printtofile = true;
ps.printfilename = ("print.xps");
//打印时幻灯片加框
ppt.slideframeforprint = true;
//灰度打印
ppt.graylevelforprint = true;
//每四张幻灯片打印到一页
ppt.slidecountperpageforprint = pageslidecount.four;
//设置打印方向
ppt.orderforprint = order.horizontal;
////打印不连续页面
//ppt.selectslidesforprint("1", "3");
//打印
ppt.print(ps);
}
vb.net
private shared sub main(args as string())
'加载示例文档
dim ppt as new presentation()
ppt.loadfromfile("sample.pptx")
'使用 printersettings 对象打印幻灯片
dim ps as new printersettings()
ps.printrange = printrange.allpages
ps.printtofile = true
ps.printfilename = ("print.xps")
'打印时幻灯片加框
ppt.slideframeforprint = true
'灰度打印
ppt.graylevelforprint = true
'每四张幻灯片打印到一页
ppt.slidecountperpageforprint = pageslidecount.four
'设置打印方向
ppt.orderforprint = order.horizontal
'''/打印不连续页面
'ppt.selectslidesforprint("1", "3");
'打印
ppt.print(ps)
end sub