> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chromiumly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Encrypt PDFs

> Encrypt existing PDFs with PDFEngines.encrypt, or via userPassword/ownerPassword on convert, merge, and split.

## PDFEngines.encrypt

Encrypts existing PDFs directly using Gotenberg's [encrypt route](https://gotenberg.dev/docs/manipulate-pdfs/encrypt-pdfs), without going through a conversion:

```typescript theme={null}
import { PDFEngines } from "chromiumly";

const encrypted = await PDFEngines.encrypt({
  files: ["path/to/document.pdf"],
  options: {
    userPassword: "my_user_password",
    ownerPassword: "my_owner_password",
    allowPrinting: false,
    allowCopying: false,
  },
});
```

At least one of `userPassword` or `ownerPassword` is required. Since Gotenberg 8.34.0, an owner-password-only request produces an owner-only PDF that opens without a password but still enforces the given permissions.

`options` also accepts the six [PDF permission](/advanced/permissions) booleans (`allowPrinting`, `allowCopying`, `allowModifying`, `allowAnnotating`, `allowFillingForms`, `allowAssembling`), each defaulting to `true`.

`downloadFrom`, `webhook`, `outputFilename`, and `trace` are also accepted — see [Request tracing](/advanced/request-tracing).

## Encryption on other routes

The same `userPassword`/`ownerPassword` and permission fields are also available directly on:

* Chromium converters (`UrlConverter`, `HtmlConverter`, `MarkdownConverter`) `convert()`
* `LibreOffice.convert()`
* `PDFEngines.merge()` and `PDFEngines.split()`

See [Encryption](/advanced/encryption) and [PDF permissions](/advanced/permissions) for the full cross-cutting reference.
