winform中doc/docx转pdf

dll下载链接: https://pan.baidu.com/s/1bpzc1Bp 密码: qteb

引用上面的dll

使用示例:

        private void Convert2Pdf(string srcPath, string pdfPath)
        {
            if (string.IsNullOrEmpty(pdfPath)) return;
            try
            {
                Document doc = new Document(srcPath);//打开文件
                //doc.RemoveAllChildren();
                //Document srcDoc = new Document(srcPath);
                //doc.AppendDocument(srcDoc, ImportFormatMode.UseDestinationStyles);
                doc.Save(pdfPath, SaveFormat.Pdf);//另存为pdf
            }
            catch (Exception ex)
            {
                MessageBox.Show("程序出错!错误信息:\r\n" + ex.Message, "提示信息");
            }
        }

  

posted @ 2016-10-20 10:08  Netop  阅读(386)  评论(0编辑  收藏  举报