java设置pdf加密_如何使用Java对PDF进行加密,密码保护和设置受限权限
java设置pdf加密
Today we will be looking at the document workhorse that is PDF, and how to programmatically employ various features: encryption, password protection, and setting permissions. For Java users, this would normally be a very time-consuming process. However, this article will be covering a much simpler approach to these tasks, as you will soon see.
今天,我们将研究PDF文档,以及如何以编程方式使用各种功能:加密,密码保护和设置权限。 对于Java用户,这通常是一个非常耗时的过程。 但是,您将很快看到,本文将涵盖一种更简单的方法来完成这些任务。
We start by adding two references. First for Jitpack among our repositories:
我们首先添加两个参考。 在我们的存储库中,Jitpack首先:
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository></repositories>
Then add our client to dependencies.
然后将我们的客户端添加到依赖项。
<dependencies><dependency> <groupId>com.github.Cloudmersive</groupId> <artifactId>Cloudmersive.APIClient.Java</artifactId> <version>v3.54</version></dependency></dependencies>
And now we can call our function for PDF encryption. Use the parameters to customize your desired permissions, passwords, etc.
现在我们可以调用函数进行PDF加密了。 使用参数自定义所需的权限,密码等。
// Import classes://import com.cloudmersive.client.invoker.ApiClient;//import com.cloudmersive.client.invoker.ApiException;//import com.cloudmersive.client.invoker.Configuration;//import com.cloudmersive.client.invoker.auth.*;//import com.cloudmersive.client.EditPdfApi;ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");Apikey.setApiKey("YOUR API KEY");// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.setApiKeyPrefix("Token");EditPdfApi apiInstance = new EditPdfApi();String ownerPassword = "ownerPassword_example"; // String | Password of a owner (creator/editor) of the PDF file (required)String userPassword = "userPassword_example"; // String | Password of a user (reader) of the PDF file (optional)File inputFile = new File("/path/to/file.txt"); // File | Input file to perform the operation on.String encryptionKeyLength = "encryptionKeyLength_example"; // String | Possible values are \"128\" (128-bit RC4 encryption) and \"256\" (256-bit AES encryption). Default is 256.Boolean allowPrinting = true; // Boolean | Set to false to disable printing through DRM. Default is true.Boolean allowDocumentAssembly = true; // Boolean | Set to false to disable document assembly through DRM. Default is true.Boolean allowContentExtraction = true; // Boolean | Set to false to disable copying/extracting content out of the PDF through DRM. Default is true.Boolean allowFormFilling = true; // Boolean | Set to false to disable filling out form fields in the PDF through DRM. Default is true.Boolean allowEditing = true; // Boolean | Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true.Boolean allowAnnotations = true; // Boolean | Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true.Boolean allowDegradedPrinting = true; // Boolean | Set to false to disable degraded printing of the PDF through DRM. Default is true.try {byte[] result = apiInstance.editPdfSetPermissions(ownerPassword, userPassword, inputFile, encryptionKeyLength, allowPrinting, allowDocumentAssembly, allowContentExtraction, allowFormFilling, allowEditing, allowAnnotations, allowDegradedPrinting);System.out.println(result);} catch (ApiException e) {System.err.println("Exception when calling EditPdfApi#editPdfSetPermissions");e.printStackTrace();}
And you are already done! Simple.
您已经完成了! 简单。
翻译自: https://medium.com/@cloudmersive/how-to-encrypt-password-protect-and-set-restricted-permissions-on-a-pdf-in-java-1eb717b069df
java设置pdf加密
http://www.taodudu.cc/news/show-5314024.html
相关文章:
- Python通过PyPDF3给pdf加密,加权限
- pdf加密 java_PDFBox加密PDF文档
- PDF文件怎么加密?推荐3种方法给你
- 基于QT的串口调试助手设计
- java 健康助手项目_GitHub - bohrqiu/watcher: watcher(守望者)提供java应用暴露监控/健康检查的能力。...
- 零基础编写一个串口网络调试助手(一)
- python 串口助手 简书_[pyqt5-pyserial实现一个串口调试工具记录]
- 番茄助手无法安装的问题
- 一款基于Qt的跨平台开源串口调试助手EasySerial
- 鼎诚服务器批量管理助手
- 串口服务器 文档,串口服务器助手
- 获取地图的geojson格式数据
- 《匆匆那年》的你,还记得吗?数学中的那些有(hui)趣(se)的定理(2)——蝴蝶定理
- 蝴蝶效应matlab程序,实验:使用Matlab对蝴蝶效应进行仿真的实验报告.doc
- Django中的ORM模型
- 逻辑回归算法模型
- dsge模型难做吗_【转载】关于DSGE模型的学习经验
- dsge模型参数估计 matlab,DSGE求解和模型参数估计的一些认识
- 详尽基础:基于PyTorch的超分重建
- php洋葱模型,【区块链安全】区块链安全性的洋葱模型
- PaddlePaddle2.0搭建VGG-16模型实现蝴蝶分类
- 蝴蝶Java_模型从卡特彼勒到蝴蝶在Java
- Solidity实现默克尔树 Merkle Tree
- Merkle trees vs Verkle trees
- 持续绩效管理带来的积极反馈文化
- 企业绩效管理体系优化方案
- asp.net工作流开发分享
- .net 移动api开发基本教程
- .NET开发常用工具大汇总
- C#Net开发 手机网站和普通网站有什么区别
java设置pdf加密_如何使用Java对PDF进行加密,密码保护和设置受限权限相关推荐
- java 字符串 加密_如何用JAVA实现字符串简单加密解密?
展开全部 java加密字符串可以使用des加密算法62616964757a686964616fe4b893e5b19e31333363376462,实例如下: package test; import ...
- java 字符串加密_如何用JAVA实现字符串简单加密解密?
展开全部 java加密字符串可以使用des加密算法,实例如62616964757a686964616fe59b9ee7ad9431333337616636下: package test; import ...
- java生成pdf方法_详解Java生成PDF文档方法|chu
最近项目需要实现PDF下载的功能,由于没有这方面的经验,从网上花了很长时间才找到相关的资料.整理之后,发现有如下几个框架可以实现这个功能. 1. 开源框架支持iText,生成PDF文档,还支持将XML ...
- java rc2加密_急求java RC2加密算法
下面是一段C++ RC2加密 要求要用java 重写 能互相加密解密 QSBEncryptRc2::QSBEncryptRc2() { EncryKey = "DingXin Com ...
- java sha256加密_如何用Sha256进行简单的加密或者解密
个人是今天第一次使用Sha256对数据进行加密操作,以往都是直接使用MD5加密最多也就是加盐之后再进行加密 不过可能是个人应用的只是简单的一个对数据的加密,所以感觉目前和MD5差距并不是很大. 1.首 ...
- java pdf 类库_有哪些可以给pdf加水印,java第三方开源类库?
使用iText ,感觉还是比较简单的 具体代码: /** * * [功能描述:添加图片和文字水印] [功能详细描述:功能详细描述] * @param srcFile 待加水印文件 * @param d ...
- 深入理解Java虚拟机知乎_深入理解Java虚拟机(类文件结构)
深入理解Java虚拟机(类文件结构) 欢迎关注微信公众号:BaronTalk,获取更多精彩好文! 之前在阅读 ASM 文档时,对于已编译类的结构.方法描述符.访问标志.ACC_PUBLIC.ACC_P ...
- java aes密钥生成_如何在Java(Android)中生成与.Net中相同的AES密钥?
我需要从.Net WebService提供的salt和密码生成 Java( Android)中的AES密钥.我需要使用与.net生成的密钥相同的密钥和相同的密码和盐(使用Rfc2898DeriveBy ...
- java不同垃圾回收器_细述 Java垃圾回收机制→Types of Java Garbage Collectors
本文非原创,翻译自Types of Java Garbage Collectors 在Java中为对象分配和释放内存空间都是由垃圾回收线程自动执行完成的.和C语言不一样的是Java程序员不需要手动写垃 ...
最新文章
- Javascript类型转换的规则
- 腾讯面试:比特位计数
- java xheditor 上传图片_xhEditor粘贴图片自动上传到服务器(Java版)
- Oracle中5个核心Sql语句的基本构造:Select、Insert、Update、Delete和Merge
- 两个pv挂一个vg_两个pv挂一个vg_VG解散LOL分部,LPL官网提前改名,下赛季被“RA”收购...
- 【C#】byte[]数据转化相关操作
- JavaScript类数组对象参考
- Android基础之图片的压缩算法
- 安卓抓包工具、方式选择
- solidworks图纸模板添加_「solidworks工程图模板」solidworks怎么添加置工程图模板? - seo实验室...
- 使用 Python 进行数据清洗的完整指南
- layer修改弹框标题样式
- android修改ipv4,Android 设置ipv4优先策略访问网络
- ssms管理linux数据库,使用 SSMS 管理 Linux 上的 SQL Server - SQL Server | Microsoft Docs
- 爬虫练习——爬取2020kpl王者荣耀职业联赛
- 说一说刚拿下BIRTV推荐的中国8K摄像机新品
- 互联网巨头:必须要裁员吗?
- java 接口函数_Java函数式接口Supplier接口实例详解
- vue3子组件给父组件传参
- MySQL之分库分表