非常简单Aspose for net实现office转pdf实例,适合新手protected void Button1_Click(object sender, EventArgs e)
{
Document doc = new Document(@"D:\test3\doc\TestWord.doc"); //载入模板
// doc.Save( Response,"demo.Pdf", ContentDisposition.Attachment, null); //保存为PDF,并打开
// doc.Save("demo.doc",SaveFormat.Doc,SaveType.OpenInWord, Response); //保存为doc,并打开
// doc.Save(@"F:\temp.pdf", SaveFormat.Pdf);
//Response.ContentType = "application/pdf";
//Response.Clear();
//Response.TransmitFile(@"F:/temp.pdf");
//Response.End();
doc.Save(@"D:\test3\doc\temp.pdf", Aspose.Words.SaveFormat.Pdf);
Response.ContentType = "application/pdf";
Response.Clear();
Response.TransmitFile(@"D:\test3\doc\temp.pdf");
Response.End();
评论