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. I.MX6 Linux 3.0.35 SD boot

    /********************************************************************************* * I.MX6 Linux 3.0 ...

  2. ECUST 12级 Practise

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26399#overview 果断开小号水过 CodeForces 58A #include ...

  3. Visual Studio2010 支持MVC4开发

    最近的项目有一个维护的版本使用的是Visual Studio2010+MVC4开发的,记录一下软件的开发环境 ============================================= ...

  4. 6-16 Topological Sort(25 分)

    Write a program to find the topological order in a digraph. Format of functions: bool TopSort( LGrap ...

  5. ubuntu系统无法ssh登录--安装openssh

    与红帽子系列的Linux发行版不同,Ubuntu系统安装后并不能直接进行ssh登录.需要手动安装openssh才行. Ubuntu安装openssh命令如下: sudo apt-get install ...

  6. MD文件

    了解一个项目,恐怕首先都是通过其Readme文件了解信息.如果你以为Readme文件都是随便写写的那你就错了.github,oschina git gitcafe的代码托管平台上的项目的Readme. ...

  7. [Luogu4609][FJOI2016]建筑师

    luogu description 一个\(1...n\)的排列,其前缀最大值有\(A\)个,后缀最大值有\(B\)个,求满足要求的排列数. 一个位置\(i\)满足前缀最大当且仅当不存在\(j< ...

  8. os、os.path、shutil操作文件和文件路径的常用方法总结

    os模块是python标准库中的一个用于访问操作系统功能的模块,下面简要介绍一下常用的命令 1.os.name().    判断现在正在使用的平台,windows返回’nt’,Linux返回‘posi ...

  9. 使用caddy 进行nodejs web应用近实时编译更新

    caddy 相比nginx 是一个不错的轻量代理服务器,支持的功能也是比较多的, 同时插件也挺多 demo 测试的是通过git 插件进行一个使用spec-md 编写的文档近实时编译以及预览 项目使用d ...

  10. FastAdmin 环境变量 env 配置

    FastAdmin 环境变量 env 配置 目前 FastAdmin 支持环境变量 env 配置. 目前支持以下环境变量 app.debug app.trace database.type datab ...