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 permission
xlsSaveOption.SecurityOptions.ExtractContentPermission = false;
//Disable print permission
xlsSaveOption.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 formats
project.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 来转的话也很快

C# 将Word,Execl,PPT,Project, 文件转成PDF, 不依赖Office!!的更多相关文章

  1. Aspose是一个很强大的控件,可以用来操作word,excel,ppt等文件

    Aspose是一个很强大的控件,可以用来操作word,excel,ppt等文件,用这个控件来导入.导出数据非常方便.其中Aspose.Cells就是用来操作Excel的,功能有很多.我所用的是最基本的 ...

  2. html文件转换成pdf和word

    1.html文件转成pdf 采用jar包有itext-asian.jar.itextpdf-5.5.5.jar.itext-pdfa-5.5.5.jar.itext-xtra-5.5.5.jar,为了 ...

  3. doc或docx(word)或image类型文件批量转PDF脚本

    doc或docx(word)或image类型文件批量转PDF脚本 1.实际生产环境中遇到文件展示只能适配PDF版本的文件,奈何一万个文件有七千个都是word或者image类型的,由此搞个脚本批量转换下 ...

  4. java 文件转成pdf文件 预览

    一.前端代码 //预览功能 preview: function () { //判断选中状态 var ids =""; var num = 0; $(".checkbox& ...

  5. java调用com组件将office文件转换成pdf

    在非常多企业级应用中都涉及到将office图片转换成pdf进行保存或者公布的场景,由于pdf格式的文档方便进行加密和权限控制(类似于百度文库).总结起来眼下将office文件转换 成pdf的方法主要有 ...

  6. dvi文件和将dvi文件转换成pdf格式

    dvi文件和将dvi文件转换成pdf格式 Latex只能把tex文件编译成dvi文件, 在cmd 中: 使用xdvi查看dvi格式的文件 若用texstudio编辑tex文件,则可直接将已编译成功的. ...

  7. asp.net将ppt文档转换成pdf

    一.添加引用 using Microsoft.Office.Core;using Microsoft.Office.Interop.PowerPoint; 二.转换方法   C# 代码   复制 // ...

  8. C# Tips: 将 VS2012 / VS2013 的.sln文件、project文件转换成 VS2010格式

    原来有一些VS2013的工程文件(.sln..csproj),使用.Net 4.0.现需要将它们转换成VS2010格式. 经实验,办法如下: (1) 在Solution文件(.sln)中: 把文件头部 ...

  9. C# 将PowerPoint文件转换成PDF文件

    PowerPoint的优势在于对演示文档的操作上,而用PPT查看资料,反而会很麻烦.这时候,把PPT转换成PDF格式保存,再浏览,不失为一个好办法.在日常编程中和开发软件时,我们也有这样的需要.本文旨 ...

随机推荐

  1. Web 端屏幕适配方案

    基础知识 像素相关 1.像素 :像素是屏幕显示最小的单位. 2.设备像素 :设备像素又称物理像素(physical pixel),设备能控制显示的最小单位,我们可以把这些像素看作成显示器上一个个的点. ...

  2. 分析器错误信息: 服务器标记不能包含 <% ... %> 构造

    我的程序如下:<form runat="server"><TABLE><TR><TD>用户名:</TD><TD&g ...

  3. leetcode122 买卖股票的最佳时机 python

    题目:给定一个数组,它表示了一只股票的价格浮动,第i个元素代表的是股票第i天的价格.设计一个函数,计算出该股票的最大收益,注意,可以多次买入卖出,但下一次买入必须是在本次持有股票卖出之后.比如[1,7 ...

  4. Git 学习记录一

    主要来源参考http://www.runoob.com/git/git-install-setup.html Windows 平台上安装 在 Windows 平台上安装 Git 同样轻松,有个叫做 m ...

  5. POJ3259 Wormholes 【Bellmanford推断是否存在负回路】

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u011775691/article/details/27612757 非常easy的bellmanf ...

  6. TCP/IP详解与OSI七层模型

    TCP/IP协议 包含了一系列构成互联网基础的网络协议,是Internet的核心协议.基于TCP/IP的参考模型将协议分成四个层次,它们分别是链路层.网络层.传输层和应用层.下图表示TCP/IP模型与 ...

  7. IIS7Appcmd 命令详解

    IIS7 Appcmd 命令详解 废话不说!虽然有配置界面管理器!但是做安装包的时候命令创建是必不可少的!最近使用NSIS制作安装包仔细研究了一下Appcmd的命令,可谓是功能齐全. 上网查了些资料, ...

  8. SQL中減少日志文件大小

    SQL中減少日志文件大小   编写人:CC阿爸 2014-6-14 在日常SQL数据库的操作中,常常会出现SQL日志文件超大,大小都超过正常MDF数据库文件,作为一般用户来讲,LDF太大,只会影响服务 ...

  9. java微信 客服接口-发消息 中文乱码

    /** * 向指定 URL 发送POST方法的请求 * * @param url *            发送请求的 URL * @param param *            请求参数,请求参 ...

  10. 黄聪:WordPress 多站点建站教程(二):后台(管理网络)设置详解,如何管理子站的用户、主题、插件、设置等功能

    建立好了子站,我们需要有个地方配置所有子站的主题.插件等功能,我们可以在后台看到 我的站点--管理网络 如下图: 在 管理网络--仪表盘 里面,我们可以创新用户和站点,也提供了查询功能. 要注意的是: ...