以下经验内容将分享通过C#编程来设置PPT幻灯片打印的方法,包括设置指定幻灯片打印页面、打印方向、纸张页面打印的幻灯片数量、灰度打印、加框打印幻灯片。
工具/原料
1
Spire.Presentation for .NET pack
2
Visual Studio
dll文件获取及引用:
1
方法1:通过E-iceblue官网下载文件包。下载后,解压文件,安装。安装完成后,将BIN文件夹下的Spire.Presentation.dll文件添加引用至C#程序。编辑代码时,添加相应的using指令。
2
方法2:可通过Nuget网站下载。
C#代码示例(供参考)
//加载文档 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);
上一篇:打印PPT铺满A4纸
下一篇:PPT幻灯片怎么打印省纸