java - 使用 Aspose PDF 可编辑到不可编辑的 pdf

标签 java aspose.pdf

如何在使用 Aspose PDF 添加一些文本后将可编辑的 pdf 保存为不可编辑的?

最佳答案

将一些文本添加到 PDF 文件后,您可以使用以下代码片段设置文档权限:

    //Open source document
    Document document = new Document(inputFile);        

    //Forbid all privileges on the document
    DocumentPrivilege privilege = DocumentPrivilege.getForbidAll();

    //Set the desired privileges
    PdfFileSecurity fileSecurity = new PdfFileSecurity(document);
    fileSecurity.setPrivilege(privilege);

    //Save resulting PDF document
    document.save(outputFile);

这将禁止所有文档权限,并且 PDF 文件将不再可编辑。我希望这会有所帮助。如果您需要任何进一步的帮助,请告诉我们。

我在 Aspose 工作,担任开发人员布道师。

关于java - 使用 Aspose PDF 可编辑到不可编辑的 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48327846/

相关文章:

java - 通过java Aspose Android

android - pdf 中的深层链接 href

java - 在Java中使用ASPOSE自动将html转换为pdf

java - DAO 在 Spring JPA 中是一个好的实践吗?

java - Tomcat负载均衡解决方案

java - GlassFish - 非法状态异常

java - "should be accessed in a static way"

java - 通过属性文件的 Restful url

pdf - 如何获取Aspose PDF中表单字段的页码?