git 地址

https://gitee.com/bandung/Execl_WordTOPDF.git

包括了各种破解的dll

Word转PDF

挨个引用

Word转PDF

    public void WordToPDF(String from,String to){try{Document doc = new Document(from);//保存为PDF文件,此处的SaveFormat支持很多种格式,如图片,epub,rtf 等等//权限这块的设置成不可复制PdfSaveOptions saveOptions = new PdfSaveOptions();// Create encryption details and set owner password.PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(string.Empty, "password", PdfEncryptionAlgorithm.RC4_128);// Start by disallowing all permissions.encryptionDetails.Permissions = PdfPermissions.DisallowAll;// Extend permissions to allow editing or modifying annotations.encryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;saveOptions.EncryptionDetails = encryptionDetails;// Render the document to PDF format with the specified permissions.
                doc.Save(to , saveOptions);//doc.Save(to, SaveFormat.Pdf);Console.WriteLine("成功!");}catch (Exception e){Console.WriteLine(e);Console.WriteLine("强行报错!");}}

Execl转 PDF

 public void ExeclToPDF(String from, String to){try{Aspose.Cells.Workbook xls = new Aspose.Cells.Workbook(from);Aspose.Cells.PdfSaveOptions xlsSaveOption = new Aspose.Cells.PdfSaveOptions();xlsSaveOption.SecurityOptions = new Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions();#region pdf 加密//Set the user password//PDF加密功能//xlsSaveOption.SecurityOptions.UserPassword = "pdfKey";//Set the owner password//xlsSaveOption.SecurityOptions.OwnerPassword = "sxbztxmgzxt";#endregion//Disable extracting content permissionxlsSaveOption.SecurityOptions.ExtractContentPermission = false;//Disable print permissionxlsSaveOption.SecurityOptions.PrintPermission = false;xlsSaveOption.AllColumnsInOnePagePerSheet = true;//权限这块的设置成不可复制PdfSaveOptions saveOptions = new PdfSaveOptions();// Create encryption details and set owner password.PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(string.Empty, "password", PdfEncryptionAlgorithm.RC4_128);// Start by disallowing all permissions.encryptionDetails.Permissions = PdfPermissions.DisallowAll;// Extend permissions to allow editing or modifying annotations.encryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;saveOptions.EncryptionDetails = encryptionDetails;// Render the document to PDF format with the specified permissions.//doc.Save(to, saveOptions);
xls.Save(to, xlsSaveOption);Console.WriteLine("转换成功!");}catch (Exception e){Console.WriteLine(e);Console.WriteLine("强行报错!");}}

PPT转PDF

public  void pptToPdf(string from, string to){Presentation ppt = new Presentation(from);ppt.Save(to, Aspose.Slides.Export.SaveFormat.Pdf);Console.WriteLine("成功!");}

Project 文件转PDF

   public void project(){var project = new Aspose.Tasks.Project("1.mpp");// save in different formatsproject.Save("file\\output.pdf", Aspose.Tasks.Saving.SaveFileFormat.PDF);project.Save("file\\output.html", Aspose.Tasks.Saving.SaveFileFormat.HTML);project.Save("file\\output.xml", Aspose.Tasks.Saving.SaveFileFormat.XML);project.Save("file\\output.png", Aspose.Tasks.Saving.SaveFileFormat.PNG);Console.WriteLine("成功!");}

把文件压缩成压缩包

using (var archive = new Archive()){archive.CreateEntry("1.pptx", @"1.pptx");archive.Save(@"result.zip");}

如果想在其他语言调用使用Thrift吧,其实java 来转的话也很快

转载于:https://www.cnblogs.com/wlphp/p/10339193.html

C# 将Word,Execl,PPT,Project, 文件转成PDF, 不依赖Office!!相关推荐

  1. html转换成word qt,PHP 将HTML转成PDF文件,HTML 转word,Word 转Html

    html转 PDF 用MPDF ,Word转Html  纯PHP的方法暂未找到Word直接转PDF的方法 可以使用 LibreOffice 6.1  (Liunx,win) 皆可使用 Html转成PD ...

  2. 两种将ppt文件转换成pdf格式的方法

    对于常接触办公文档的童鞋们来说,应该对pdf文件并不陌生吧,pdf具有跨平台.稳定性.安全性阅读良好等优势,正因为如此,许多企业将pdf作为一种重要的文档因为工作需求常常需要将编辑好的ppt转换成pd ...

  3. Acrobat如何将word文件转换成pdf格式

    很多朋友电脑装了Adobe Acrobat,却不知道Acrobat如何将word文件转换成pdf格式,现在就给大家讲解一下.比如,我们电脑安装Adobe Acrobat  Professional 7 ...

  4. 用Python批处理将WORD文件转换成PDF格式(工具:win32com模块)

    用Python批处理将WORD文件转换成PDF格式 一.问题分析 key words:批处理.WORD转换PDF.办公自动化 二.材料准备 三.代码实现 ☆其他问题:日常遇到问题,整理笔记不易,欢迎交 ...

  5. 怎么把ppt文件转换成pdf?解决方法有这几种

    想必对于PPT和PDF文件都比较熟悉了呗!那怎么解决将PPT格式转成PDF格式呢? 其实PPT转换成PDF格式的话还是很简单的,部分软件通过另存为命令就可以帮你轻松搞定了,可是要想转回去就没那么简单了 ...

  6. 批量将多个 PPT 幻灯片文件合并成单个 PPT 文件

    概要:我们经常处理 PPT 幻灯片文件,有时候我们有很多个 PPT 幻灯片文件需要整理.最常见的需求就是我们需要批量的将多个 PPT 幻灯片文件合并成一个独立的 PPT 文件,这个时候该怎么办呢?如果 ...

  7. 将word文件转换成PDF的两种方法

    由于工作需要,使用了两种方式实现了word文件转PDF的功能.以下的程序是我使用VB6编写,供大家参考. 第一种方法,使用PDFMAKERAPILib,使用这种方法,可以设置文件的安全性.这种方式是A ...

  8. 经验:从ppt复制到word中的图片在导出成PDF后出现黑框怎么解决

    经验:从ppt复制到word中的图片在导出成PDF后出现黑框怎么解决 更新历史 20190602: 首次发布 在使用ppt和word的过程中,发现一个现象:将ppt中的图片复制到word中时,图片是没 ...

  9. vs 如何将源文件转换成可执行文件_如何将图片文件转换成PDF文件?

    小编的一个朋友是做室内设计的,大家都知道做室内设计或者其它一些关于设计方面的工作都少不了画图.他每天会画很多张图并且还会反复修改,非常麻烦.有的图会因为不小心鼠标或者键盘误点了,导致一些图的数据错误, ...

  10. sql文件转成json格式_10秒就能将任意格式的文件转成PDF,简单易操作,不学可别后悔...

    为什么今天我们会谈到将其他常用格式的文件转成PDF呢?其中一个最重要的原因就是防止他人随意更改我们所做的文件,下面我们就针对常用格式文件转成PDF,这一问题来具体说说怎么操作. 一.PC端操作 1.o ...

最新文章

  1. 配置Activiti Explorer使用MYSQL
  2. C#软件自动更新程序
  3. powerdesigner反向MySQL5.1数据库 生成ER图
  4. 如何解开机器学习的面纱?
  5. 数据结构基础(2) --顺序查找 二分查找
  6. vue中解决three.js出现内存泄漏丢失上下文问题
  7. zabbix详解(三)——zabbix源码安装与部署
  8. ES6新语法之let关键字;有别于传统关键字var的使用
  9. python面向对象中类对象、实例对象、类变量、实例变量、类方法、实例方法、静态方法...
  10. ENVI相关操作总结(更新中......)
  11. Hibernate(转载)
  12. ZT: 排名前50个常用软件下载(带序列号)
  13. 感谢蜂窝教育,四个月的学习,让我改变了
  14. zt电脑围棋中的人工智能技术
  15. 江苏小高考计算机知识点,江苏文科小高考哪几门 考试内容是什么
  16. 2019年最佳JavaScript日历和事件日历脚本
  17. 小程序页面如何直接调用云存储中的图片
  18. 【转】Android屏幕适配全攻略(最权威的官方适配指导)
  19. Java快递驿站项目
  20. ubuntu修改u盘权限_Ubuntu下U盘只读文件系统,图标上锁,提示无法修改

热门文章

  1. cout一位小数_C++ cout 如何保留小数输出
  2. jmeter 报405错误_jmeter压测报错问题汇总:
  3. python计算导数_科学网—python计算导数jacobian以及hessian - 于博的博文
  4. python 清华镜像_树莓派raspberry4B入坑指南 part-1 virtualenv安装python
  5. c语言 入字符要中文状态吗,常见的HTTP状态码深入理解
  6. mysql sql语句执行到一半会怎么样?
  7. 为什么下拉框拉不下来_为什么分手后对方不删除拉黑你,但又不和你复合?
  8. 【POJ1050+POJ2018+HDOJ6638+牛客1006D】最大子段和问题
  9. redis 加载mysql_Mysql Redis PostgreSQL数据库查看客户端连接
  10. 用计算机弹假面骑士build,假面骑士build使用的武器汇总,你知道几个?