{"id":18029796,"url":"https://github.com/ajaxray/merge2pdf","last_synced_at":"2026-03-12T08:20:31.045Z","repository":{"id":142566862,"uuid":"118930975","full_name":"ajaxray/merge2pdf","owner":"ajaxray","description":"Merge Image and PDF files (optionally with selective pages) with lossless quality","archived":false,"fork":false,"pushed_at":"2018-07-15T05:52:14.000Z","size":98,"stargazers_count":81,"open_issues_count":7,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-23T00:51:19.449Z","etag":null,"topics":["go","golang","image-merge","multiple-pdfs","pdf","pdf-merge","unidoc"],"latest_commit_sha":null,"homepage":null,"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-01-25T15:30:30.000Z","updated_at":"2025-03-10T20:45:07.000Z","dependencies_parsed_at":"2023-05-05T10:30:34.161Z","dependency_job_id":null,"html_url":"https://github.com/ajaxray/merge2pdf","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmerge2pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmerge2pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmerge2pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fmerge2pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajaxray","download_url":"https://codeload.github.com/ajaxray/merge2pdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245778576,"owners_count":20670682,"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":["go","golang","image-merge","multiple-pdfs","pdf","pdf-merge","unidoc"],"created_at":"2024-10-30T09:11:30.763Z","updated_at":"2026-03-12T08:20:25.999Z","avatar_url":"https://github.com/ajaxray.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# merge2pdf - Merge Image and PDF files into PDF \n\nSimplest command line tool for merging Images and PDFs. \nIt will not convert PDF pages (with texts, images, forms) into flat image, everything will remain as is.\n\n![merge2pdf - simplest tool for merging image and PDF files](extra/merge2pdf_banner.png?raw=true) \n\nHighlights -\n\n- Very simple and easy to use \n- Lossless quality by default. Option to adjust JPEG quality.\n- Can be merged only selective pages of PDF \n- Supports wide range of image formats\n- Options to adjust size, margin and scaling of image\n- Supports directory as input (merges all Images/PDFs of directory)\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/merge2pdf/releases) for your OS. Then rename and give it execute permission.\n```bash\nmv merge2pdf_linux-amd64 merge2pdf  \nsudo chmod +x merge2pdf\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 merge2pdf /usr/local/bin/merge2pdf\n```\nDone! \n\n### How to use\n\n```bash\n# Merge multiple PDFs\nmerge2pdf output.pdf input1.pdf input2.pdf path/to/other.pdf ...\n\n# Merge 1st page of input1.pdf, full input2.pdf and 2nd, 3rd, 4th page of input3.pdf  \nmerge2pdf output.pdf input1.pdf~1 input2.pdf input3.pdf~2,3,4\n\n# Merge multiple Images\nmerge2pdf output.pdf image1.jpg image2.jpg path/to/other.png ...\n\n# Merge all Images/PDFs of one or multiple directory\nmerge2pdf output.pdf path/to/a/dir path/to/another ...\n\n# Mixing up PDF, PDF Pages, Images and directories\nmerge2pdf output.pdf doc1.pdf~1,2 image1.jpg path/to/dir path/to/other.pdf ...\n```\n\n### Fine tuning Image pages\n\nWhen adding Images, by default the size for image containing pages will be same to image size with 1 inch margin on each side. But you may set custom margins and resize to standard Print size.\n```bash\n# Set image page size to A4. Other Options are A3, Legal and Letter\nmerge2pdf -s A4 output.pdf image1.jpg image2.jpg\n\n# Set image page size and margin (left, right, top, bottom).\nmerge2pdf -s A3 -m .5,.5,1,1 output.pdf image1.jpg image2.jpg\n# margin can be set without size\n\n# Scale images to page width, with aspect ratio\n# To scale to height, use --scale-height\nmerge2pdf -s A3 -m .5,.5,1,1 --scale-width output.pdf image1.jpg image2.jpg\n\n# For JPEG, you can set optimized quality\nmerge2pdf -m 0,0,0,0 --jpeg-quality=80 output.pdf image1.jpg image2.jpg\n```\n_Note: When adding images and PDFs together, these options will effect ONLY Image pages._\n\n\nIf your filename contains space or [some special characters](https://unix.stackexchange.com/a/270979), \nthen quote the filepaths along with page numbers. For safety, you can quote them always. \n```bash\nmerge2pdf output.pdf \"With Space.pdf\" \"without-space.pdf\" \"with space and pages.pdf~2,3,4\"\n```\n\nTo see details of options, \n```bash\nmerge2pdf -h\n```\n### Notes\n\n- `--size`, `--margin`, `--scale-width`, `--scale-height` will only effect images. \n- PDF pages will inherit size and margin of source PDF\n- _Some_ `.tiff` files (e,g, compression level 4) may not work properly\n- Directory inputs will be searched for image/PDF files on first level only. Subdirectories will be skipped.\n\n### Roadmap\n\n✅ Merge multiple PDFs without loosing quality  \n✅ Merge multiple PDFs with **selective pages**  \n✅ Adding Images  \n✅ Mixing up Images and PDFs    \n✅️ Merge all (Image and PDF) files from directory  \n✅ Option to Resize Images to reduce filesize  \n◻️ Option to Greyscale Images to reduce filesize  \n◻️ Option to set files and pages as JSON config to make usages from other app more convenient    \n\n### Contribute\n\nIf you fix a bug or want to add/improve a feature, \nand it's alligned with the focus (merging with ease) of this tool, \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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaxray%2Fmerge2pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajaxray%2Fmerge2pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaxray%2Fmerge2pdf/lists"}