Editable for editable PDF using Aspose PDF

How to save editable pdf as Non-Editable after adding some text to it using Aspose PDF?

+4
source share
1 answer

After adding some text to the PDF file, you can set the document rights using the code snippet below:

    //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);

This prohibits all rights to documents and the PDF file will no longer be edited. Hope this will be helpful. Please let us know if you need further assistance.

I work with Aspose as an evangelist developer.

+2
source

Source: https://habr.com/ru/post/1692385/


All Articles