{"id":22415788,"url":"https://github.com/xmas7/stapler","last_synced_at":"2025-03-27T04:18:43.879Z","repository":{"id":143167504,"uuid":"533097743","full_name":"xmas7/stapler","owner":"xmas7","description":"Stapler is a pure Python alternative to PDFtk, a tool for manipulating PDF documents from the command line.","archived":false,"fork":false,"pushed_at":"2022-09-06T00:04:57.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T09:27:42.913Z","etag":null,"topics":["alernative","pdf","pdftk","python","stapler","tool"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xmas7.png","metadata":{"files":{"readme":"README.rst","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":"2022-09-06T00:01:36.000Z","updated_at":"2024-05-20T11:09:14.000Z","dependencies_parsed_at":"2023-06-02T17:30:31.658Z","dependency_job_id":null,"html_url":"https://github.com/xmas7/stapler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fstapler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fstapler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fstapler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fstapler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xmas7","download_url":"https://codeload.github.com/xmas7/stapler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245779486,"owners_count":20670688,"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":["alernative","pdf","pdftk","python","stapler","tool"],"created_at":"2024-12-05T15:13:43.158Z","updated_at":"2025-03-27T04:18:43.869Z","avatar_url":"https://github.com/xmas7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Stapler\n=======\n\nStapler is a pure Python alternative to\n`PDFtk \u003chttp://www.pdfhacks.com/pdftk/\u003e`__, a tool for manipulating PDF\ndocuments from the command line.\n\nHistory\n-------\n\nPDFtk was written in Java and C++, and is natively compiled with gcj.\nSadly, it has been discontinued a few years ago and bitrot is setting in\n(e.g., it does not compile easily on a number of platforms).\n\nPhilip Stark decided to look for an alternative and found pypdf, a PDF\nlibrary written in pure Python. He couldn't find a tool which actually\nused the library, so he started writing his own.\n\nVersion 0.3 of stapler was completely refactored by Fred Wenzel. He also\nadded tests and awesome functionality.\n\nLike pdftk, stapler is a command-line tool. If you would like to add a\nGUI, compile it into a binary for your favorite platform, or contribute\nanything else, feel free to fork and send a pull request.\n\nContributors and Authorship\n---------------------------\n\nStapler version 0.2 was written in 2009 by Philip Stark. Stapler version\n0.3 was written in 2010 by Fred Wenzel.\n\nFor a list of contributors, check the ``CONTRIBUTORS`` file.\n\nChange log (sorta)\n------------------\n\n- **0.3.3** include try-except blocks for supporting legacy pyPdf\n  if needed. Also fixes some PyPI issues like the missing License Trove\n  classifier and some dependencies.\n\n- **0.3.0** Refactoring by Fred Wenzel and now using PyPDF2\n\n- **0.2.0** Feature completeness using original pyPdf\n\nLicense\n-------\n\nStapler is distributed under a BSD license. A copy of the BSD Style\nLicense used can be found in the file ``LICENSE``.\n\nUsage\n-----\n\nThere are the following modes in Stapler:\n\nselect/delete (called with ``sel`` and ``del``, respectively)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n``sel`` is also available as ``cat`` for compatibility with my\npersonal muscle memory. :)\n\nWith select, you can cherry-pick pages from pdfs and concatenate them\ninto a new pdf file.\n\nSyntax:\n\n::\n\n    stapler sel input1 page_or_range [page_or_range ...] [input2 p_o_r ...]\n\nExamples:\n\n::\n\n    # concatenate a and b into output.pdf\n    stapler sel a.pdf b.pdf output.pdf\n\n    # generate a pdf file called output.pdf with the following pages:\n    # 1, 4-8 in 180° (D for down), 20-40 from a.pdf, 1-5 from b.pdf in \n    # this order\n    stapler sel a.pdf 1 4-8D 20-40 b.pdf 1-5 output.pdf\n\n    # reverse some of the pages in a.pdf by specifying a negative range\n    stapler sel a.pdf 1-3 9-6 10 output.pdf\n\nThe delete command works almost exactly the same as select, but inverse.\nIt uses the pages and ranges which you *didn't* specify.\n\nsplit/burst:\n~~~~~~~~~~~~\n\nSplits the specified pdf files into their single pages and writes each\npage into it's own pdf file with this naming scheme:\n\n::\n\n    ${origname}_${zero-padded page no}.pdf\n\nSyntax:\n\n::\n\n    stapler split input1 [input2 input3 ...]\n\nExample for a file foobar.pdf with 20 pages:\n\n::\n\n    $ stapler split foobar.pdf\n    $ ls\n    foobar_01.pdf foobar_02.pdf ... foobar_19.pdf foobar_20.pdf\n\nMultiple files can be specified, they will be processed as if you called\nsingle instances of stapler.\n\nzip:\n~~~~\n\nWith zip, you can cherry-pick pages from pdfs (like select). The pages\nfrom each pdf are merged together in an interleaving manner. This can be\nused to collate a pdf with odd pages and a pdf with even pages into a\nsingle file.\n\nSyntax: stapler zip input1 [range[rotation]] [range ...] [input2\n[range...] ...] out\n\nExamples:\n\n::\n\n    # combine a pdf with odd pages and a pdf with even pages into output.pdf\n    stapler zip odd.pdf even.pdf output.pdf\n\n    # combine a.pdf b.pdf and c.pdf, but use only some pages of c.pdf and\n    #  rotate b.pdf right (90° clockwise) and rotate c.pdf left (90° counter-\n    # clockwise)\n    stapler zip a.pdf b.pdf 1-endR c.pdf 1-3L output.pdf\n\nIf one of the ranges is shorter than the others, stapler will continue\nto merge the remaining pages.\n\ninfo:\n~~~~~\n\nShows information on the metadata stored inside a PDF file.\n\nSyntax:\n\n::\n\n    stapler info foo.pdf\n\nExample output:\n\n::\n\n    \\*\\*\\* Metadata for foo.pdf\n\n    /ModDate:  D:20100313082451+01'00'\n    /CreationDate:  D:20100313082451+01'00'\n    /Producer:  GPL Ghostscript 8.70\n    /Title:  foo.pdf\n    /Creator:  PDFCreator Version 0.9.9\n    /Keywords:\n    /Author:  John Doe\n    /Subject:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmas7%2Fstapler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxmas7%2Fstapler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmas7%2Fstapler/lists"}