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

Editable to Non-Editable pdf using 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 工作,担任开发人员传播者。