如何仅使用javascript使用密码保护pdf文件?

如何仅使用javascript使用密码保护pdf文件?,javascript,pdf,alfresco,Javascript,Pdf,Alfresco,我发现使用java类可以用密码保护pdf文件 private static String USER_PASS = "Hello123"; private static String OWNER_PASS = "Owner123"; public static void main(String[] args) { try { OutputStream file = new FileOutputStream(new File("D:\\

我发现使用java类可以用密码保护pdf文件

private static String USER_PASS = "Hello123";

    private static String OWNER_PASS = "Owner123";


    public static void main(String[] args) {
        try {

            OutputStream file = new FileOutputStream(new File("D:\\Test.pdf"));

            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, file);

            writer.setEncryption(USER_PASS.getBytes(), OWNER_PASS.getBytes(),
                    PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128);

            document.open();
            document.add(new Paragraph("Hello World, iText"));
            document.add(new Paragraph(new Date().toString()));

            document.close();
            file.close();

        } catch (Exception e) {

            e.printStackTrace();
        }
    }
但是我们如何使用javascript保护pdf文件。 我已经提到了社区问题,但我无法解决我的问题。 是否有任何源代码可以帮助我更多。
请提供帮助。

可能是重复的,谢谢您的评论。是的,但我没有找到任何用于制作带有密码保护的pdf的源代码。