我们如何通过asp.net将word文档转换为pdf。我通过FileUpload& amp;浏览一个ms-word文件。当我点击确定时,它会自动将该文件转换为PDF。 [英] how can we convert word document into pdf by asp.net. I browse a ms-word file by FileUpload & when i click on OK, it automatically convert that file into PDF.
问题描述
如何通过asp.net将word文档转换为pdf。我通过FileUpload浏览一个ms-word文件,当我点击OK时,它会自动将该文件转换为PDF。任何人都可以指导我怎么可能。我得到了谷歌的一些代码,但那是不完整的。如果有人知道解决方案请与我分享。
how can we convert word document into pdf by asp.net. I browse a ms-word file by FileUpload & when i click on OK, it automatically convert that file into PDF. Can anybody guide me how can be it possible. I got some code by google but thats are incomplete. If Anybody know the solution kindly share with me.
推荐答案
尝试一些代码:
Try some codes:
// Open document.
Document doc = new Document("resume.doc");
// Save all pages of the docuemnt as separete PDFs.
for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)
{
PdfSaveOptions options = new PdfSaveOptions();
options.PageIndex = pageIndex;
options.PageCount = 1;
doc.Save(string.Format("out_{0}.pdf", pageIndex), options);
}
或
Or
Document doc = new Document("C:\\Temp\\Kane_International_Tax_Spring_2011.docx");
doc.Save("C:\\Temp\\out.pdf");
或以下代码:
or the following code:
Document doc = new Document("C:\\Temp\\Kane_International_Tax_Spring_2011.docx");
PdfSaveOptions options = new PdfSaveOptions();
options.PageCount = 1;
for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)
{
string outputFileName = string.Format("{0}\\{1}_{2}.pdf", "C:\\Temp", "Test", pageIndex + 1);
options.PageIndex = pageIndex;
doc.Save(outputFileName, options);
}
将Word文档转换为PDF [ ^ ]
在ASP.NET中创建PDF文档 [ ^ ]
将Word文档转换为PDF格式ASP.NET服务器 [ ^ ]
详细讨论代码 [ ^ ]
Convert a Word Document to PDF[^]
Creating PDF Documents in ASP.NET[^]
Convert Word-Documents to PDF on an ASP.NET Server[^]
Detailed discussion with code[^]
Ohhhhh ..你只是通过这个链接dude ..
在ASP.NET服务器上将Word文档转换为PDF
Ohhhhh.. you just go through this link dude..
Convert Word-Documents to PDF on an ASP.NET Server
在发布问题之前进行简单的Google / CP搜索。这是 Google [ ^ ]链接你。
谢谢
--RA
Hi,
Do a simple Google/CP search before posting a question. here is the Google[^] link for you.
Thanks
--RA
这篇关于我们如何通过asp.net将word文档转换为pdf。我通过FileUpload& amp;浏览一个ms-word文件。当我点击确定时,它会自动将该文件转换为PDF。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!