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. node 使用范围 和 node的优势 (为什么 创业公司 选择的不是 java php ruby 等)

    链接 一些国外大公司 范围: 第一: 希望合并后台多个接口 成为一个接口,  或者频繁改动接口 相关, 比如数据 和数据格式之类,  后台难以配合, 这里可以使用node作为后台的应用层调用其他接口 ...

  2. web前端开发常用的几种图片格式及其使用规范

    首先,在正式说图片格式之前,咱们先说一些额外的东西. 矢量图与位图 矢量图是通过组成图形的一些基本元素,如点.线.面,边框,填充色等信息通过计算的方式来显示图形的.一般来说矢量图表示的是几何图形,文件 ...

  3. 第十课 C++异常简介

    异常不是错误,异常是程序中可预料到的另一条执行分支,是可预见的.错误是不可预料的. C++内置了异常处理的语法元素try...catch...,如下: C++通过throw语句抛出异常信息: 上图中t ...

  4. ubuntu遇到的问题

    昨天分辨率在装一个游戏时被更改了,改过之后,怎么都改不过来... 折腾了一下午,在配置文件中/etc/X11/xorg.conf.failsafe,但是网上都是/etc/X11/xorg.conf, ...

  5. C# 根据twitter的snowflake算法生成唯一ID

    C# 版算法: using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...

  6. 服务器大量TIME_WAIT和CLOSE_WAIT的原因及解决办法

    Linux服务器下查看网络连接的状态 netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 它会显示例如下面的信息: ...

  7. INET_ADDRSTRLEN 和 INET6_ADDRSTRLEN 长度

    在<netinet/in.h>中有这两个宏的定义 #define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 INET_ADDRSTRLE ...

  8. streamsets docker 安装试用

    docker 安装 docker run --restart on-failure -p 18630:18630 -d --name streamsets-dc streamsets/datacoll ...

  9. ringojs 使用rp 包管理web 应用依赖

    rp 是一个类似npm 的包管理工具,我们可以使用package.json 定义依赖 然后执行rp install 即可,类似ringo-admin 的功能 其中packages 类似node 的no ...

  10. asp.net(C#)链接Oracle连接字符串

    在NET环境中链接Oracle数据库有两种组建链接方式: 1)使用OleDB组件是通过Oracle OleDB驱动程序(OraOLEDB.dll)连接和访问Oracle数据库2)使用System.Da ...