{"id":28226281,"url":"https://github.com/pro-2684/pdf-perm","last_synced_at":"2026-03-04T06:03:16.996Z","repository":{"id":286294188,"uuid":"961006588","full_name":"PRO-2684/PDF-Perm","owner":"PRO-2684","description":"Change the permissions of a PDF file.","archived":false,"fork":false,"pushed_at":"2025-04-17T14:44:57.000Z","size":273,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-19T10:03:23.466Z","etag":null,"topics":["cli","metadata","pdf","pdf-decrypt","pdf-desecure","permissions","security"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PRO-2684.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-05T14:53:56.000Z","updated_at":"2025-10-02T09:02:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"abbdcc39-460a-4fdc-b64f-7c31a92a6b3c","html_url":"https://github.com/PRO-2684/PDF-Perm","commit_stats":null,"previous_names":["pro-2684/pdf-perm"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/PRO-2684/PDF-Perm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRO-2684%2FPDF-Perm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRO-2684%2FPDF-Perm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRO-2684%2FPDF-Perm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRO-2684%2FPDF-Perm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PRO-2684","download_url":"https://codeload.github.com/PRO-2684/PDF-Perm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRO-2684%2FPDF-Perm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30073691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T05:31:57.858Z","status":"ssl_error","status_checked_at":"2026-03-04T05:31:38.462Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","metadata","pdf","pdf-decrypt","pdf-desecure","permissions","security"],"created_at":"2025-05-18T11:11:04.044Z","updated_at":"2026-03-04T06:03:16.970Z","avatar_url":"https://github.com/PRO-2684.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PDF-Perm\n\n[![GitHub License](https://img.shields.io/github/license/PRO-2684/PDF-Perm?logo=opensourceinitiative)](https://github.com/PRO-2684/PDF-Perm/blob/main/LICENSE)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/PRO-2684/PDF-Perm/release.yml?logo=githubactions)](https://github.com/PRO-2684/PDF-Perm/blob/main/.github/workflows/release.yml)\n[![GitHub Release](https://img.shields.io/github/v/release/PRO-2684/PDF-Perm?logo=githubactions)](https://github.com/PRO-2684/PDF-Perm/releases)\n[![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/PRO-2684/PDF-Perm/total?logo=github)](https://github.com/PRO-2684/PDF-Perm/releases)\n[![Crates.io Version](https://img.shields.io/crates/v/pdf-perm?logo=rust)](https://crates.io/crates/pdf-perm)\n[![Crates.io Total Downloads](https://img.shields.io/crates/d/pdf-perm?logo=rust)](https://crates.io/crates/pdf-perm)\n[![docs.rs](https://img.shields.io/docsrs/pdf-perm?logo=rust)](https://docs.rs/pdf-perm)\n\nChange the permissions of a PDF file.\n\n## Installation\n\n### Using `binstall`\n\n```shell\ncargo binstall pdf-perm\n```\n\n### Downloading from Releases\n\nNavigate to the [Releases page](https://github.com/PRO-2684/PDF-Perm/releases) and download respective binary for your platform. Make sure to give it execute permissions.\n\n### Compiling from Source\n\n```shell\ncargo install pdf-perm\n```\n\n## Examples\n\n\u003cdetails\u003e\u003csummary\u003eClick to see demo asciicast\u003c/summary\u003e\n\n[![asciicast](https://asciinema.org/a/8HjO0gIyUd4e1j4qFsRrF10Zk.svg)](https://asciinema.org/a/8HjO0gIyUd4e1j4qFsRrF10Zk)\n\n\u003c/details\u003e\n\nThe usage is quite similar to `chmod` command:\n\n```shell\npdf-perm +c no-copy.pdf\n```\n\nThis will modify `no-copy.pdf` and make it copiable. Bugs may arise, so make sure to backup if it matters. Alternatively, by specifying another path, this tool will write to there instead of overwriting the original file:\n\n```shell\npdf-perm +c no-copy.pdf can-copy.pdf\n```\n\nTo reject a permission, use `-`:\n\n```shell\npdf-perm -c can-copy.pdf no-copy.pdf\n```\n\nTo set exactly the permissions you want, use `=`:\n\n```shell\npdf-perm =pma my.pdf\n```\n\nThis will set the permissions to `PRINTABLE`, `MODIFIABLE`, and `ANNOTABLE` and reject all other permissions.\n\nTo grant all permissions, use `+*` or `=*`; to reject all permissions, use `-*`:\n\n```shell\npdf-perm +* confidential.pdf declassified.pdf\n```\n\nSome example PDF files are provided in the [`samples`](./samples/) directory. You can use them to test the program.\n\n## Usage\n\n```shell\npdf-perm [PERMISSION] \u003cINPUT\u003e [OUTPUT]\n```\n\n| Argument Length | Interpretation                  |\n| --------------- | ------------------------------- |\n| 0               | Print help and permissions      |\n| 1               | `\u003cINPUT\u003e`                       |\n| 2               | `[PERMISSION] \u003cINPUT\u003e`          |\n| 3               | `[PERMISSION] \u003cINPUT\u003e [OUTPUT]` |\n| 4+              | Invalid                         |\n\n### Permission\n\nThe permission argument is a string that specify the permissions to be set on the PDF file. It must starts with one of the following:\n\n- `+`: to grant permissions\n- `-`: to reject permissions\n- `=`: to set permissions exactly\n\nThen, you can specify the short flags for the permissions you want to grant, reject, or set exactly. Valid short flags and their [corresponding constant](https://docs.rs/lopdf/0.36.0/lopdf/encryption/struct.Permissions.html#impl-Permissions) in [`lopdf` crate](https://docs.rs/lopdf/0.36.0/lopdf/) are:\n\n| #   | Short Flag | Constant                      |\n| --- | ---------- | ----------------------------- |\n| 3   | `p`        | **P**RINTABLE                 |\n| 4   | `m`        | **M**ODIFIABLE                |\n| 5   | `c`        | **C**OPYABLE                  |\n| 6   | `a`        | **A**NNOTABLE                 |\n| 9   | `f`        | **F**ILLABLE                  |\n| 10  | `x`        | COPYABLE_FOR_ACCESSIBILITY    |\n| 11  | `s`        | A**S**SEMBLABLE               |\n| 12  | `q`        | PRINTABLE_IN_HIGH_**Q**UALITY |\n| /   | `*`        | All permissions               |\n\n\u003e [!NOTE]\n\u003e\n\u003e - The index in the tables are $1$-based.\n\u003e - The actual permissions you see on PDF readers may differ from the ones you see using this tool. This is because some permissions imply others.\n\u003e - See the [PDF 1.4 ref](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.4.pdf), TABLE 3.15 for more details.\n\nIf this argument is not specified, `pdf-perm` will print the permissions of the input file and exit.\n\n### Input\n\n**Required**. Path to the input PDF file. This file will be modified in place unless an output path is specified.\n\n### Output\n\nPath to the output PDF file. If not specified, the input file will be modified in place.\n\n## The DeSec Mode\n\nWhen the last part of the `argv[0]` matches `(pdf-)?desec(ure)?` (case-insensitive, without extension), the program will run in \"DeSec\" mode. In this mode, the program will only accept one argument, input file path, asking for it if not provided. The program will then grant all permissions to the PDF file, effectively removing all restrictions.\n\nTypically, you can rename the binary or create a symlink as `pdf-desec` or `desec` to enable this mode. In this way, simply dragging and dropping a PDF file onto the binary will remove all restrictions from it.\n\n## Caveats\n\n- This crate does NOT handle **password protected** PDFs. Consider decrypting them first, or using [pdfrip](https://github.com/mufeedvh/pdfrip) to break the password.\n- Currently, only PDF 1.4 is supported.\n\n## Credits\n\n- [abatsakidis/PDFDeSecure](https://github.com/abatsakidis/PDFDeSecure/tree/master/Example-PDF), for the inspiration.\n- [J-F-Liu/lopdf](https://github.com/J-F-Liu/lopdf), for the `lopdf` crate, which is used to read and write PDF files.\n\n## TODO\n\n- [ ] Preserve `EncryptionVersion`\n- [ ] Allow specifying `EncryptionVersion` if not present\n- [x] Implement `chmod` like syntax (`-`, `+`, `=`)\n- [x] Extended syntax\n    - [x] `*` for all permissions\n- [x] DeSec mode\n- [x] Set to `None` if permissions are default\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpro-2684%2Fpdf-perm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpro-2684%2Fpdf-perm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpro-2684%2Fpdf-perm/lists"}