typst / typst

A new markup-based typesetting system that is powerful and easy to learn.
https://typst.app
Apache License 2.0
35.79k stars 957 forks source link

Password-protect PDFs #4387

Open MarkusFF opened 5 months ago

MarkusFF commented 5 months ago

Description

PDFs have encryption support that allow you to password-protect aspects of the PDF to prevent e.g. reading, modification, printing etc. On some tex flavours this could be achieved with, for example:

\special{pdf:encrypt ownerpw (abc) userpw (xyz) length 128 perm 2052}

This is a feature widely used in PDFs that are sold, such as research papers, standards documents and so on. Although frequently overused this is likely an essential feature for some users.

It should be noted that a PDF can already be modified in this way after generation, for example with pdftk

Use Case

jamesrswift commented 5 months ago

I imagine this would make for a good cli argument (it deals only with pdf exports so I don't think it should belong in document source itself)

Enivex commented 5 months ago

This is a feature widely used in PDFs that are sold, such as research papers,

I can't recall ever having seen a password protected paper. They're hidden behind a paywall, but the actual pdf is not protected in any way.

jamesrswift commented 5 months ago

This is a feature widely used in PDFs that are sold, such as research papers,

I can't recall ever having seen a password protected paper. They're hidden behind a paywall, but the actual pdf is not protected in any way.

I've mostly seen it when dealing with conference stuff

asmaier commented 4 months ago

As a workaround you can simply zip the PDF and set a password for the zip file.

mohe2015 commented 4 months ago

The issue author already said there are tools that can add a password to a PDF so I think that is not an issue. This is about integrating such functionality into Typst.