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. 学习 Flask 扩展 Flask-RESTful

    pip install Flask-RESTful Flask-RESTful扩展.首先,我们来安装上面这个扩展. from flask import Flask from flask_restful ...

  2. js在一定时间内跳转页面及各种页面刷新

    1.js 代码: <SCRIPT LANGUAGE="JavaScript"> var time = 5; //时间,秒 var timelong = 0; funct ...

  3. nginx 配置 getsimplecms 配置文件

    getsimplecms的安装需要两个php类库,一个是dom操作,一个是gd library. 所以先安装这两个类库,重启php解释器. yum install php-xml; yum insta ...

  4. Codeforces 580B: Kefa and Company(前缀和)

    http://codeforces.com/problemset/problem/580/B 题意:Kefa有n个朋友,要和这n个朋友中的一些出去,这些朋友有一些钱,并且和Kefa有一定的友谊值,要求 ...

  5. 文本框模糊匹配(纯html+jquery简单实现)

    一.项目中需要用到此功能,使用过EasyUI中的Combobox,网上也搜过相应的解决办法,对于我的项目来说都不太合适,因为我还是喜欢比较纯粹的东西,就自己动手写了一个,比较简单,但还算能用,我的项目 ...

  6. json-patch 了解

    What is JSON Patch? JSON Patch is a format for describing changes to a JSON document. It can be used ...

  7. WF从入门到精通学习目录

    WF从入门到精通(第一章):WF简介 WF从入门到精通(第二章):workflow运行时 WF从入门到精通(第三章):workflow实例 WF从入门到精通(第四章):活动及workflow类型介绍 ...

  8. 关于oracle的profiles

    一.关于oracle的profiles profiles文件是口令和资源限制的配置集合,包括CPU的时间.I/O的使用.空闲时间.连接时间.并发会话数量.密码策略等对于资源的使用profile可以做到 ...

  9. Linux之 增加swap空间

    引言 :有时候我们会遇到安装os时候,swap分区过小,导致某些大软件无法安装的问题.我们可以在linux下增大swap分区的空间. 以下的操作都要在root用户下执行: 0. 记录原 swap 分区 ...

  10. Jenkins 基础入门

    原文地址:Jenkins 基础入门 博客地址:http://www.extlight.com 一.前言 Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作, ...