{"id":18029797,"url":"https://github.com/ajaxray/markpdf","last_synced_at":"2025-04-09T15:08:31.130Z","repository":{"id":41274879,"uuid":"159459963","full_name":"ajaxray/markpdf","owner":"ajaxray","description":"Watermark PDF files using image or text","archived":false,"fork":false,"pushed_at":"2024-07-17T12:56:09.000Z","size":39,"stargazers_count":191,"open_issues_count":19,"forks_count":38,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T15:08:24.699Z","etag":null,"topics":["cli","developer-tools","pdf","pdf-document","utility","watermark","watermark-pdf-files"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajaxray.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}},"created_at":"2018-11-28T07:14:43.000Z","updated_at":"2025-03-28T09:38:19.000Z","dependencies_parsed_at":"2024-06-18T21:37:09.436Z","dependency_job_id":"2eea5170-2b3f-48a5-9fba-035fca8fdbfe","html_url":"https://github.com/ajaxray/markpdf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmarkpdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmarkpdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmarkpdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmarkpdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajaxray","download_url":"https://codeload.github.com/ajaxray/markpdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055283,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","developer-tools","pdf","pdf-document","utility","watermark","watermark-pdf-files"],"created_at":"2024-10-30T09:11:31.133Z","updated_at":"2025-04-09T15:08:31.112Z","avatar_url":"https://github.com/ajaxray.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# markpdf - Watermark PDF files using image or text\n\nA tiny command line tool for watermarking PDF files using image or text. \nWith simple options to configure position, opacity, rotation, stretch etc.\n\nHighlights -\n\n- Very simple and easy to use \n- Extreamly fast!\n- Stretching watermark image to height or weight proportionately \n- Options to adjust position, opacity, rotation of image\n- Placeholder for text watermark\n- Tile image watermark all over the page\n- Free and open source\n\n## Install\n\nIt's just a single binary file, no external dependencies. \nJust download the appropriate version of [executable from latest release](https://github.com/ajaxray/markpdf/releases) for your OS. Then rename and give it execute permission.\n```bash\nmv markpdf_linux-amd64 markpdf  \nsudo chmod +x markpdf\n```\n\nIf you want to install it globally (run from any directory of your system), put it in your systems $PATH directory.\n```bash\nsudo mv markpdf /usr/local/bin/markpdf\n```\nDone! \n\n## How to use\n\n### Image watermarking\n\nCommand options are shown in both, shorthand and full name.\n\n```bash\n# watermark with all default options (on top left corner with 50% opacity)\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\"\n\n# watermark at center\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --center\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" -c\n\n# watermark at right top with 20px offset from edge and full opaque\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --offset-x=-20 --offset-y=20 --opacity=1.0\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" -x -20 -y 20 -o 1.0\n\n# watermark at left bottom with 100px offset and 45 degree rotation\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --offset-x=100 --offset-y=-100 --angle=45\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" -x 100 -y -100 -a 45\n\n# stretch full with of page at page middle, with 30% opacity\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --scale-width-center --opacity=0.3\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" -Wo 0.3\n# Note the capital \"W\" \n\n# stretch full with of page at page bottom\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --scale-width --offset-y=-10\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" -wy -10\n\n# Scale the image to desired percentage\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --scale=30\n\n# Add image as tiles all over the page\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --tiles\n\n# Add image as tiles with interleaved spacing\nmarkpdf \"path/to/source.pdf\" \"img/logo.png\" \"path/to/output.pdf\" --tiles --spacing=20\n```\n\n\n### Text watermarking\n\n```bash\n# watermark text at right top with 20px offset from edge\nmarkpdf \"path/to/source.pdf\" \"The Company Name\" \"path/to/output.pdf\" --offset-x=-20 --offset-y=20\nmarkpdf \"path/to/source.pdf\" \"The Company Name\" \"path/to/output.pdf\" -x -20 -y 20\n\n# Place text at center with bold-italic \"Times Roman\" font in blue color\nmarkpdf \"path/to/source.pdf\" \"The Company Name\" \"path/to/output.pdf\" --center --font=times_bold_italic --color=0000FF\nmarkpdf \"path/to/source.pdf\" \"The Company Name\" \"path/to/output.pdf\" -cf times_bold_italic -l 0000FF\n\n# Place text at center with large bold-italic \"Times Roman\" font in blue color\nmarkpdf \"path/to/source.pdf\" \"The Company Name\" \"path/to/output.pdf\" --center --font=times_bold_italic --font-size=24.0 --color=0000FF\nmarkpdf \"path/to/source.pdf\" \"The Company Name\" \"path/to/output.pdf\" -cf times_bold_italic -s 24.0 -l 0000FF\n```\n\n#### Using placeholders with text watermark\n\nThe following placeholder can be used in text watermark:\n- `{{.Page}}` prints the current page number\n- `{{.Pages}}` prints the total page numbers\n- `{{.Filename}}` prints name of the source file\n\n```bash\n# Using placeholders in text watermark\nmarkpdf \"path/to/083.pdf\" \"File: {{.Filename}} Page {{.Page}} of {{.Pages}}\" \"path/to/voucher_083.pdf\" -x -20 -y 30\n```\n\n#### Allowed font identifiers \n\nCurrently the following font names are supported:\n- **Courier**:\t`courier`, `courier_bold`, `courier_oblique`, `courier_bold_oblique`\n- **Helvetica**:\t`helvetica`, `helvetica_bold`, `helvetica_oblique`, `helvetica_bold_oblique`\n- **Times Roman**:\t`times`, `times_bold`, `times_italic`, `times_bold_italic`\n\n### Additional notes\n\n- **Specifying Colors**: write them as 6 or 3 digit hexadecilal as used in CSS, without the #\n\n- `--color`, `--font` and `--font-size` flag has no impact for Image watermarking\n- `--scale-*`, `--tiles` and `--opacity` flag has no impact for Text watermarking\n- Negative offset will set content positioning from opposite side (right for offsetX and botom from offsetY)\n- Text with opacity is not supported at this moment. Instead, you can [create a transperent background PNG image](http://www.picturetopeople.org/text_generator/others/transparent/transparent-text-generator.html) with your text and then use it for watermarking.\n\n## Roadmap\n\n✅ Draw image on every page of PDF  \n✅ Configure Opacity option  \n✅ Configure watermark position by X and Y offset  \n✅ Allow negative values to for offset to adjust from opposite direction  \n✅️ Easy option for positioning image at center  \n✅ Configure image rotation angle  \n✅ Options to Stretch watermark to page width or height, proportionately  \n✅ Options to Stretch watermark to page width or height at the middle of page  \n✅ Tile Image all over the page  \n✅ Render text on every page  \n✅ Configure text color, style and font  \n⏺ Configure text opacity  \n✅ Configure text rotation angle  \n✅ Text placement by offset  \n✅ Put text at page center  \n\n### Contribute\n\nIf you fix a bug or want to add/improve a feature, \nand it's alligned with the focus of this tool - _watermarking PDF with ease_, \nI will be glad to accept your PR. :) \n\n### Thanks\n\nThis tool was made using the beautiful [Unidoc](https://unidoc.io/) library. Thanks and ❤️ to **Unidoc**.\n\n---\n\u003e \"This is the Book about which there is no doubt, a guidance for those conscious of Allah\" - [Al-Quran](http://quran.com)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaxray%2Fmarkpdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajaxray%2Fmarkpdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaxray%2Fmarkpdf/lists"}