如何以编程方式将Word文件转换为PDF ?

时间:2022-10-30 12:06:21

I have found several open-source/freeware programs that allow you to convert .doc files to .pdf files, but they're all of the application/printer driver variety, with no SDK attached.

我找到了几个开源/免费软件程序,允许您将.doc文件转换为.pdf文件,但它们都是应用程序/打印机驱动程序的变体,不附带任何SDK。

I have found several programs that do have an SDK allowing you to convert .doc files to .pdf files, but they're all of the proprietary type, $2,000 a license or thereabouts.

我发现有几个程序确实有SDK允许你把。doc文件转换成。pdf文件,但是它们都是私有类型,一个许可证大约2000美元。

Does anyone know of any clean, inexpensive (preferably free) programmatic solution to my problem, using C# or VB.NET?

有人知道用c#或VB.NET来解决我的问题吗?

Thanks!

谢谢!

14 个解决方案

#1


184  

Use a foreach loop instead of a for loop - it solved my problem.

使用foreach循环而不是for循环——它解决了我的问题。

int j = 0;
foreach (Microsoft.Office.Interop.Word.Page p in pane.Pages)
{
    var bits = p.EnhMetaFileBits;
    var target = path1 +j.ToString()+  "_image.doc";
    try
    {
        using (var ms = new MemoryStream((byte[])(bits)))
        {
            var image = System.Drawing.Image.FromStream(ms);
            var pngTarget = Path.ChangeExtension(target, "png");
            image.Save(pngTarget, System.Drawing.Imaging.ImageFormat.Png);
        }
    }
    catch (System.Exception ex)
    {
        MessageBox.Show(ex.Message);  
    }
    j++;
}

Here is a modification of a program that worked for me. It uses Word 2007 with the Save As PDF add-in installed. It searches a directory for .doc files, opens them in Word and then saves them as a PDF. Note that you'll need to add a reference to Microsoft.Office.Interop.Word to the solution.

这是对一个对我有用的程序的修改。它使用Word 2007,并安装了Save作为PDF外接程序。它搜索目录中的.doc文件,在Word中打开它们,然后保存为PDF格式。注意,您需要添加对Microsoft.Office.Interop的引用。词的解决方案。

using Microsoft.Office.Interop.Word;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

...

// Create a new Microsoft Word application object
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();

// C# doesn't have optional arguments so we'll need a dummy value
object oMissing = System.Reflection.Missing.Value;

// Get list of Word files in specified directory
DirectoryInfo dirInfo = new DirectoryInfo(@"\\server\folder");
FileInfo[] wordFiles = dirInfo.GetFiles("*.doc");

word.Visible = false;
word.ScreenUpdating = false;

foreach (FileInfo wordFile in wordFiles)
{
    // Cast as Object for word Open method
    Object filename = (Object)wordFile.FullName;

    // Use the dummy value as a placeholder for optional arguments
    Document doc = word.Documents.Open(ref filename, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing);
    doc.Activate();

    object outputFileName = wordFile.FullName.Replace(".doc", ".pdf");
    object fileFormat = WdSaveFormat.wdFormatPDF;

    // Save document into PDF Format
    doc.SaveAs(ref outputFileName,
        ref fileFormat, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing);

    // Close the Word document, but leave the Word application open.
    // doc has to be cast to type _Document so that it will find the
    // correct Close method.                
    object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
    ((_Document)doc).Close(ref saveChanges, ref oMissing, ref oMissing);
    doc = null;
}

// word has to be cast to type _Application so that it will find
// the correct Quit method.
((_Application)word).Quit(ref oMissing, ref oMissing, ref oMissing);
word = null;

#2


28  

To sum it up for vb.net users, the free option (must have office installed):

对于vb.net用户,免费选项(必须安装office):

Microsoft office assembies download:

微软office assembies下载:

  • pia for office 2010
  • pia办公室2010
  • pia for office 2007

    pia办公室2007

  • Add reference to Microsoft.Office.Interop.Word.Application

    添加引用Microsoft.Office.Interop.Word.Application

  • Add using or import (vb.net) statement to Microsoft.Office.Interop.Word.Application

    向Microsoft.Office.Interop.Word.Application添加use或import (vb.net)语句

VB.NET example:

VB。净的例子:

        Dim word As Application = New Application()
        Dim doc As Document = word.Documents.Open("c:\document.docx")
        doc.Activate()
        doc.SaveAs2("c:\document.pdf", WdSaveFormat.wdFormatPDF)
        doc.Close()

#3


12  

PDFCreator has a COM component, callable from .NET or VBScript (samples included in the download).

PDFCreator有一个COM组件,可从. net或VBScript调用(下载中包含示例)。

But, it seems to me that a printer is just what you need - just mix that with Word's automation, and you should be good to go.

但是,在我看来,打印机正是你所需要的——只要把它与Word的自动化结合起来,你就会做得很好。

#4


7  

There's an entire discussion of libraries for converting Word to PDF on Joel's discussion forums. Some suggestions from the thread:

在乔尔的论坛上,有一个完整的关于将Word转换为PDF的库的讨论。提示:

#5


5  

Just wanted to add that I used Microsoft.Interop libraries, specifically ExportAsFixedFormat function which I did not see used in this thread.

只是想补充一点,我用的是微软。Interop库,特别是ExportAsFixedFormat函数,我在这个线程中没有看到它。

    using Microsoft.Office.Interop.Word;
    using System.Runtime.InteropServices;
    using System.IO;
    using Microsoft.Office.Core;Application app;

    public string CreatePDF(string path, string exportDir)
    {
        Application app = new Application();
        app.DisplayAlerts = WdAlertLevel.wdAlertsNone;
        app.Visible = true;

        var objPresSet = app.Documents;
        var objPres = objPresSet.Open(path, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);

        var baseFileName = Path.GetFileNameWithoutExtension(path);
        var pdfFileName = baseFileName + ".pdf";
        var pdfPath = Path.Combine(exportDir, pdfFileName);

        try
        {
            objPres.ExportAsFixedFormat(
                pdfPath,
                WdExportFormat.wdExportFormatPDF,
                false,
                WdExportOptimizeFor.wdExportOptimizeForPrint,
                WdExportRange.wdExportAllDocument
            );
        }
        catch
        {
            pdfPath = null;
        }
        finally
        {
            objPres.Close();
        }
        return pdfPath;
    }

#6


4  

I went through the Word to PDF pain when someone dumped me with 10000 word files to convert to PDF. Now I did it in C# and used Word interop but it was slow and crashed if I tried to use PC at all.. very frustrating.

当有人向我扔了10000个单词文件,要我把它们转换成PDF格式时,我把这个单词读了一遍又一遍。现在我用c#做了,使用了Word interop,但是如果我尝试使用PC的话,它会很慢并且崩溃。非常令人沮丧。

This lead me to discovering I could dump interops and their slowness..... for Excel I use (EPPLUS) and then I discovered that you can get a free tool called Spire that allows converting to PDF... with limitations!

这让我发现我可以丢弃interops和它们的迟钝……对于Excel,我使用(EPPLUS),然后我发现你可以得到一个免费的工具,叫做Spire,允许转换为PDF…限制!

http://www.e-iceblue.com/Introduce/free-doc-component.html#.VtAg4PmLRhE

http://www.e-iceblue.com/Introduce/free-doc-component.html .VtAg4PmLRhE

#7


3  

I do this as part of a release process - convert a Word Doc to PDF.

作为发布过程的一部分——将Word文档转换为PDF。

http://www.suodenjoki.dk/us/productions/articles/word2pdf.htm and http://www.oooforum.org/forum/viewtopic.phtml?t=3772&highlight=pdf+form

http://www.suodenjoki.dk/us/productions/articles/word2pdf.htm和http://www.oooforum.org/forum/viewtopic.phtml?t=3772&highlight=pdf +形式

not exactly programmatically, but may help you.

不完全是程序化的,但可能会对您有所帮助。

#8


3  

When I stumbled upon some problems with server side office automation we looked into the technique described here on codeproject. It uses the portable version (which can be deployed via xcopy) of OpenOffice in combination with a macro. Although we haven't done the switch ourselves yet, it looks very promissing.

当我偶然发现服务器端办公室自动化的一些问题时,我们研究了codeproject上描述的技术。它使用OpenOffice的可移植版本(可以通过xcopy部署)与宏结合使用。虽然我们自己还没有做过改变,但看起来很有希望。

#9


2  

I have been impressed with Gembox (http://www.gemboxsoftware.com/) who provide a limited free edition of document management (includes pdf conversion). They also do libraries for spreadsheets. The 1 developer licence if you exceed their limits (which I imagine you will) though is around $580 (http://www.gemboxsoftware.com/document/pricelist). OK, it's not free (or in my opinion relatively inexpensive) but it is a lot cheaper than $2000. As I understand it from their price list there is no royalty either for server deployments. Might be worth approaching them and seeing if they'll do a deal if you don't want to roll your own.

我对Gembox (http://www.gemboxsoftware.com/)印象深刻,它提供了一个有限的免费版本的文档管理(包括pdf转换)。他们还为电子表格做库。如果你超过了他们的限制(我想你会这么做),那么1个开发人员的许可证就会达到580美元(http://www.gemboxsoftware.com/document/pricelist)。好吧,它不是免费的(或者在我看来相对不贵),但它比2000美元便宜得多。我从他们的价格表中了解到,服务器部署也没有版税。如果你不想自己卷的话,也许值得接近他们,看看他们是否会达成协议。

#10


1  

Seems to be some relevent info here:

这里似乎有一些相关的信息:

Converting MS Word Documents to PDF in ASP.NET

在ASP.NET中将MS Word文档转换为PDF

Also, with Office 2007 having publish to PDF functionality, I guess you could use office automation to open the *.DOC file in Word 2007 and Save as PDF. I'm not too keen on office automation as it's slow and prone to hanging, but just throwing that out there...

另外,由于Office 2007已经发布到PDF功能,我猜您可以使用Office自动化来打开*。DOC文件在Word 2007,保存为PDF。我不太喜欢办公室自动化,因为它很慢而且容易上吊,但只是把它扔出去……

#11


1  

I used ABCpdf which is a programmatic option and wasn't too expensive, $300/license. It works with either OpenOffice, or falls back to Word if OpenOffice isn't available. The setup was a bit tricky with the OpenOffice COM permissions, but it was definitely worth outsourcing that part of the app.

我使用了ABCpdf,这是一个程序化的选项,不太贵,300美元/张。它可以与OpenOffice一起工作,也可以在OpenOffice不可用时使用Word。OpenOffice COM的权限设置有点棘手,但将应用程序的这一部分外包出去绝对值得。

#12


1  

Microsoft PDF add-in for word seems to be the best solution for now but you should take into consideration that it does not convert all word documents correctly to pdf and in some cases you will see huge difference between the word and the output pdf. Unfortunately I couldn't find any api that would convert all word documents correctly. The only solution I found to ensure the conversion was 100% correct was by converting the documents through a printer driver. The downside is that documents are queued and converted one by one, but you can be sure the resulted pdf is exactly the same as word document layout. I personally preferred using UDC (Universal document converter) and installed Foxit Reader(free version) on server too then printed the documents by starting a "Process" and setting its Verb property to "print". You can also use FileSystemWatcher to set a signal when the conversion has completed.

微软PDF插件词似乎是最好的解决方案,但你应该考虑,它并不正确所有的word文档转换成PDF和在某些情况下,您将看到巨大的区别词和输出PDF。不幸的是我找不到任何api会将所有正确的word文档。唯一的解决方法我发现,以确保转换的转换是100%正确的文件通过一个打印机驱动程序。不利的一面是,文档是排队和转换一个接一个,但可以肯定的是pdf word文档布局完全相同。我个人更喜欢使用UDC福昕阅读器(通用文档转换器)和安装(免费版)在服务器然后打印文档的开始一个“过程”,将其动词属性设置为“打印”。您还可以使用FileSystemWatcher转换完成时设置一个信号。

#13


1  

As long as you have Word 2010 or later installed you can use DocTo which provides a commandline application to do this.

只要安装了Word 2010或以后的版本,就可以使用DocTo提供命令行应用程序来实现这一点。

#14


-4  

I have used iTextSharp to generate PDFs before. It's an open source port of iText from the Java world and is pretty powerful.

我以前用过iTextSharp来生成pdf。它是来自Java世界的开放源码端口,非常强大。

I haven't explicitly done a Word to PDF conversion, but I have programmatically created and manipulated PDFs with it.

我还没有对PDF格式的转换做过明确的修改,但是我已经通过编程创建和操作了PDF文件。

Here is another link to to the project.

这是另一个项目的链接。

#1


184  

Use a foreach loop instead of a for loop - it solved my problem.

使用foreach循环而不是for循环——它解决了我的问题。

int j = 0;
foreach (Microsoft.Office.Interop.Word.Page p in pane.Pages)
{
    var bits = p.EnhMetaFileBits;
    var target = path1 +j.ToString()+  "_image.doc";
    try
    {
        using (var ms = new MemoryStream((byte[])(bits)))
        {
            var image = System.Drawing.Image.FromStream(ms);
            var pngTarget = Path.ChangeExtension(target, "png");
            image.Save(pngTarget, System.Drawing.Imaging.ImageFormat.Png);
        }
    }
    catch (System.Exception ex)
    {
        MessageBox.Show(ex.Message);  
    }
    j++;
}

Here is a modification of a program that worked for me. It uses Word 2007 with the Save As PDF add-in installed. It searches a directory for .doc files, opens them in Word and then saves them as a PDF. Note that you'll need to add a reference to Microsoft.Office.Interop.Word to the solution.

这是对一个对我有用的程序的修改。它使用Word 2007,并安装了Save作为PDF外接程序。它搜索目录中的.doc文件,在Word中打开它们,然后保存为PDF格式。注意,您需要添加对Microsoft.Office.Interop的引用。词的解决方案。

using Microsoft.Office.Interop.Word;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

...

// Create a new Microsoft Word application object
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();

// C# doesn't have optional arguments so we'll need a dummy value
object oMissing = System.Reflection.Missing.Value;

// Get list of Word files in specified directory
DirectoryInfo dirInfo = new DirectoryInfo(@"\\server\folder");
FileInfo[] wordFiles = dirInfo.GetFiles("*.doc");

word.Visible = false;
word.ScreenUpdating = false;

foreach (FileInfo wordFile in wordFiles)
{
    // Cast as Object for word Open method
    Object filename = (Object)wordFile.FullName;

    // Use the dummy value as a placeholder for optional arguments
    Document doc = word.Documents.Open(ref filename, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing);
    doc.Activate();

    object outputFileName = wordFile.FullName.Replace(".doc", ".pdf");
    object fileFormat = WdSaveFormat.wdFormatPDF;

    // Save document into PDF Format
    doc.SaveAs(ref outputFileName,
        ref fileFormat, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing);

    // Close the Word document, but leave the Word application open.
    // doc has to be cast to type _Document so that it will find the
    // correct Close method.                
    object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
    ((_Document)doc).Close(ref saveChanges, ref oMissing, ref oMissing);
    doc = null;
}

// word has to be cast to type _Application so that it will find
// the correct Quit method.
((_Application)word).Quit(ref oMissing, ref oMissing, ref oMissing);
word = null;

#2


28  

To sum it up for vb.net users, the free option (must have office installed):

对于vb.net用户,免费选项(必须安装office):

Microsoft office assembies download:

微软office assembies下载:

  • pia for office 2010
  • pia办公室2010
  • pia for office 2007

    pia办公室2007

  • Add reference to Microsoft.Office.Interop.Word.Application

    添加引用Microsoft.Office.Interop.Word.Application

  • Add using or import (vb.net) statement to Microsoft.Office.Interop.Word.Application

    向Microsoft.Office.Interop.Word.Application添加use或import (vb.net)语句

VB.NET example:

VB。净的例子:

        Dim word As Application = New Application()
        Dim doc As Document = word.Documents.Open("c:\document.docx")
        doc.Activate()
        doc.SaveAs2("c:\document.pdf", WdSaveFormat.wdFormatPDF)
        doc.Close()

#3


12  

PDFCreator has a COM component, callable from .NET or VBScript (samples included in the download).

PDFCreator有一个COM组件,可从. net或VBScript调用(下载中包含示例)。

But, it seems to me that a printer is just what you need - just mix that with Word's automation, and you should be good to go.

但是,在我看来,打印机正是你所需要的——只要把它与Word的自动化结合起来,你就会做得很好。

#4


7  

There's an entire discussion of libraries for converting Word to PDF on Joel's discussion forums. Some suggestions from the thread:

在乔尔的论坛上,有一个完整的关于将Word转换为PDF的库的讨论。提示:

#5


5  

Just wanted to add that I used Microsoft.Interop libraries, specifically ExportAsFixedFormat function which I did not see used in this thread.

只是想补充一点,我用的是微软。Interop库,特别是ExportAsFixedFormat函数,我在这个线程中没有看到它。

    using Microsoft.Office.Interop.Word;
    using System.Runtime.InteropServices;
    using System.IO;
    using Microsoft.Office.Core;Application app;

    public string CreatePDF(string path, string exportDir)
    {
        Application app = new Application();
        app.DisplayAlerts = WdAlertLevel.wdAlertsNone;
        app.Visible = true;

        var objPresSet = app.Documents;
        var objPres = objPresSet.Open(path, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);

        var baseFileName = Path.GetFileNameWithoutExtension(path);
        var pdfFileName = baseFileName + ".pdf";
        var pdfPath = Path.Combine(exportDir, pdfFileName);

        try
        {
            objPres.ExportAsFixedFormat(
                pdfPath,
                WdExportFormat.wdExportFormatPDF,
                false,
                WdExportOptimizeFor.wdExportOptimizeForPrint,
                WdExportRange.wdExportAllDocument
            );
        }
        catch
        {
            pdfPath = null;
        }
        finally
        {
            objPres.Close();
        }
        return pdfPath;
    }

#6


4  

I went through the Word to PDF pain when someone dumped me with 10000 word files to convert to PDF. Now I did it in C# and used Word interop but it was slow and crashed if I tried to use PC at all.. very frustrating.

当有人向我扔了10000个单词文件,要我把它们转换成PDF格式时,我把这个单词读了一遍又一遍。现在我用c#做了,使用了Word interop,但是如果我尝试使用PC的话,它会很慢并且崩溃。非常令人沮丧。

This lead me to discovering I could dump interops and their slowness..... for Excel I use (EPPLUS) and then I discovered that you can get a free tool called Spire that allows converting to PDF... with limitations!

这让我发现我可以丢弃interops和它们的迟钝……对于Excel,我使用(EPPLUS),然后我发现你可以得到一个免费的工具,叫做Spire,允许转换为PDF…限制!

http://www.e-iceblue.com/Introduce/free-doc-component.html#.VtAg4PmLRhE

http://www.e-iceblue.com/Introduce/free-doc-component.html .VtAg4PmLRhE

#7


3  

I do this as part of a release process - convert a Word Doc to PDF.

作为发布过程的一部分——将Word文档转换为PDF。

http://www.suodenjoki.dk/us/productions/articles/word2pdf.htm and http://www.oooforum.org/forum/viewtopic.phtml?t=3772&highlight=pdf+form

http://www.suodenjoki.dk/us/productions/articles/word2pdf.htm和http://www.oooforum.org/forum/viewtopic.phtml?t=3772&highlight=pdf +形式

not exactly programmatically, but may help you.

不完全是程序化的,但可能会对您有所帮助。

#8


3  

When I stumbled upon some problems with server side office automation we looked into the technique described here on codeproject. It uses the portable version (which can be deployed via xcopy) of OpenOffice in combination with a macro. Although we haven't done the switch ourselves yet, it looks very promissing.

当我偶然发现服务器端办公室自动化的一些问题时,我们研究了codeproject上描述的技术。它使用OpenOffice的可移植版本(可以通过xcopy部署)与宏结合使用。虽然我们自己还没有做过改变,但看起来很有希望。

#9


2  

I have been impressed with Gembox (http://www.gemboxsoftware.com/) who provide a limited free edition of document management (includes pdf conversion). They also do libraries for spreadsheets. The 1 developer licence if you exceed their limits (which I imagine you will) though is around $580 (http://www.gemboxsoftware.com/document/pricelist). OK, it's not free (or in my opinion relatively inexpensive) but it is a lot cheaper than $2000. As I understand it from their price list there is no royalty either for server deployments. Might be worth approaching them and seeing if they'll do a deal if you don't want to roll your own.

我对Gembox (http://www.gemboxsoftware.com/)印象深刻,它提供了一个有限的免费版本的文档管理(包括pdf转换)。他们还为电子表格做库。如果你超过了他们的限制(我想你会这么做),那么1个开发人员的许可证就会达到580美元(http://www.gemboxsoftware.com/document/pricelist)。好吧,它不是免费的(或者在我看来相对不贵),但它比2000美元便宜得多。我从他们的价格表中了解到,服务器部署也没有版税。如果你不想自己卷的话,也许值得接近他们,看看他们是否会达成协议。

#10


1  

Seems to be some relevent info here:

这里似乎有一些相关的信息:

Converting MS Word Documents to PDF in ASP.NET

在ASP.NET中将MS Word文档转换为PDF

Also, with Office 2007 having publish to PDF functionality, I guess you could use office automation to open the *.DOC file in Word 2007 and Save as PDF. I'm not too keen on office automation as it's slow and prone to hanging, but just throwing that out there...

另外,由于Office 2007已经发布到PDF功能,我猜您可以使用Office自动化来打开*。DOC文件在Word 2007,保存为PDF。我不太喜欢办公室自动化,因为它很慢而且容易上吊,但只是把它扔出去……

#11


1  

I used ABCpdf which is a programmatic option and wasn't too expensive, $300/license. It works with either OpenOffice, or falls back to Word if OpenOffice isn't available. The setup was a bit tricky with the OpenOffice COM permissions, but it was definitely worth outsourcing that part of the app.

我使用了ABCpdf,这是一个程序化的选项,不太贵,300美元/张。它可以与OpenOffice一起工作,也可以在OpenOffice不可用时使用Word。OpenOffice COM的权限设置有点棘手,但将应用程序的这一部分外包出去绝对值得。

#12


1  

Microsoft PDF add-in for word seems to be the best solution for now but you should take into consideration that it does not convert all word documents correctly to pdf and in some cases you will see huge difference between the word and the output pdf. Unfortunately I couldn't find any api that would convert all word documents correctly. The only solution I found to ensure the conversion was 100% correct was by converting the documents through a printer driver. The downside is that documents are queued and converted one by one, but you can be sure the resulted pdf is exactly the same as word document layout. I personally preferred using UDC (Universal document converter) and installed Foxit Reader(free version) on server too then printed the documents by starting a "Process" and setting its Verb property to "print". You can also use FileSystemWatcher to set a signal when the conversion has completed.

微软PDF插件词似乎是最好的解决方案,但你应该考虑,它并不正确所有的word文档转换成PDF和在某些情况下,您将看到巨大的区别词和输出PDF。不幸的是我找不到任何api会将所有正确的word文档。唯一的解决方法我发现,以确保转换的转换是100%正确的文件通过一个打印机驱动程序。不利的一面是,文档是排队和转换一个接一个,但可以肯定的是pdf word文档布局完全相同。我个人更喜欢使用UDC福昕阅读器(通用文档转换器)和安装(免费版)在服务器然后打印文档的开始一个“过程”,将其动词属性设置为“打印”。您还可以使用FileSystemWatcher转换完成时设置一个信号。

#13


1  

As long as you have Word 2010 or later installed you can use DocTo which provides a commandline application to do this.

只要安装了Word 2010或以后的版本,就可以使用DocTo提供命令行应用程序来实现这一点。

#14


-4  

I have used iTextSharp to generate PDFs before. It's an open source port of iText from the Java world and is pretty powerful.

我以前用过iTextSharp来生成pdf。它是来自Java世界的开放源码端口,非常强大。

I haven't explicitly done a Word to PDF conversion, but I have programmatically created and manipulated PDFs with it.

我还没有对PDF格式的转换做过明确的修改,但是我已经通过编程创建和操作了PDF文件。

Here is another link to to the project.

这是另一个项目的链接。