摘要: 一、 需求:将HTML转PDF打印。Web项目中总是有这样的需求,很是让人苦恼。二、 分析:如何完成这个工作?1、 需要解析HTML,然后利用itextsharp绘制pdf文档。解析HTML是一个很难完成的任务,各个浏览器对HTML的解析五花八门就知道这不好解决。这条路不好走,但也是可以完成的,通过webbrowser类可以解析HTML获取各对象的位置,然后绘制到pdf中。方法是可行,其中的复杂度不小。2、 将HTML保存为图片,然后插入到pdf文档中,这里将介绍这种方法。随之而来的问题:如何将HTML保存为图片呢?三、 解决办法:1、 将HTML保存为图片:需要用到webbrower类,将指 阅读全文
posted @ 2011-01-26 17:01 Nina 阅读(1182) 评论(0) 推荐(0) 编辑
摘要: 下载并安装SaveAsPDF.exe需要安装Office 2007和Microsoft提供的“Microsoft Save as PDF or XPS Add-in for 2007 Microsoft Office programs”组件,可以从官网下载。以下是代码(我用的Chrome浏览器,无法添加程序块,面前看吧。代码是我正在用的,无错误,直接复制过来)//ppt转pdfusingMicrosoft.Office.Interop.PowerPoint;usingMicrosoft.Office.core; protected void PPTToPDF(string fileNameD 阅读全文
posted @ 2011-01-26 15:44 Nina 阅读(442) 评论(0) 推荐(0) 编辑
摘要: 下载并安装SaveAsPDF.exeThis section illustrates how to save an Excel 2007 workbook programmatically in the PDF and XPS file formats. There are five steps to this procedure:Adding a reference to the Excel 12.0 Object Library.Importing theExcel Interopassembly namespace.Creating an instance of theApplicati 阅读全文
posted @ 2011-01-26 15:09 Nina 阅读(689) 评论(0) 推荐(0) 编辑
摘要: 下载SaveAsPDF.exe 并安装To programmatically save a Word 2007 document to either the PDF format or the XPS formatAdd a reference to the Word 12.0 Object Library.Import the Word 2007 interop assembly namespace.Create an instance of theApplicationClassobject.Declare the appropriate variablesImplement the co 阅读全文
posted @ 2011-01-26 15:00 Nina 阅读(484) 评论(0) 推荐(1) 编辑