{"id":22914470,"url":"https://github.com/hernancerm/pric","last_synced_at":"2025-08-12T09:30:52.099Z","repository":{"id":113766308,"uuid":"277651746","full_name":"hernancerm/Pric","owner":"hernancerm","description":"👨🏻‍💻 Print code files to a PDF","archived":false,"fork":false,"pushed_at":"2020-11-26T16:33:07.000Z","size":366,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-08T22:05:28.660Z","etag":null,"topics":["asciidoctorj","bash","cli-app","groovy-script","pdf-generation","picocli"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hernancerm.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":"2020-07-06T21:23:46.000Z","updated_at":"2023-04-02T11:44:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8d7d834-beeb-4363-a277-4a8bc4c63042","html_url":"https://github.com/hernancerm/Pric","commit_stats":null,"previous_names":["hernancerm/pric"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernancerm%2FPric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernancerm%2FPric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernancerm%2FPric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hernancerm%2FPric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hernancerm","download_url":"https://codeload.github.com/hernancerm/Pric/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229665326,"owners_count":18104029,"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":["asciidoctorj","bash","cli-app","groovy-script","pdf-generation","picocli"],"created_at":"2024-12-14T05:15:13.195Z","updated_at":"2024-12-14T05:15:13.690Z","avatar_url":"https://github.com/hernancerm.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 👨🏻‍💻 Pric: Print Code\n\nThe goal of this tool is to provide an easy way to produce a PDF out of a set of code files.\n\n| ℹ | Pric is slow, it takes some seconds to print the usage help and a bit longer to produce the PDF. |\n|---|:---|\n\n## Usage\n\nGiven the following project, we can generate a PDF out of the Java files.\n\n```\n.\n`-- src\n    |-- META-INF\n    |   `-- MANIFEST.MF\n    `-- hercerm\n        `-- iindices\n            |-- app\n            |   |-- ApplicationStarter.java\n            |   `-- WordSearcherApplication.java\n            |-- core\n            |   |-- FileContentCleanser.java\n            |   |-- IIValue.java\n            |   |-- IIndexGenerator.java\n            |   |-- REPL.java\n            |   |-- REPLCommands.java\n            |   |-- TXTCleanser.java\n            |   `-- WordSearcher.java\n            `-- util\n                |-- FileDownloader.java\n                |-- PathsAccessor.java\n                `-- Serializer.java\n\n```\n\nTo create the PDF, simply run:\n\n```bash\npric output_file.pdf -re java\n```\n\nWhich produces `output_file.pdf`, with a cover page, syntax highlighted code listings and a table of contents shown by the PDF reader:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg width=720px src=\"images/non_compact_demo.png\"\u003e\n\u003c/p\u003e\n\n## Options\n\n```\n$ pric -h\n\nPrint multiple source code files to a single PDF file.\n\npric [OPTIONS] file\n\nParameters:\n      file                Filename of the PDF, must end in '.pdf'.\n\nOptions:\n  -a, --author=\u003cauthor\u003e   Author of the document.\n  -c, --compact           Produce a PDF with more code per page and no cover\n                            page.\n  -e, --extensions=\u003cext\u003e[,\u003cext\u003e...]\n                          Extensions of the files to be printed.\n  -f, --files=\u003cregex\u003e[:\u003cregex\u003e...]\n                          Match filenames by regex.\n  -h, --help              Show this help message and exit.\n  -k, --keep-asciidoc     Preserve AsciiDoc file after PDF generation.\n  -p, --paths=\u003cpath\u003e[?\u003cpath\u003e...]\n                          Absolute or relative paths to directories to search\n                            for files (default is current dir)\n  -r, --recursive         Recurse sub-directories.\n  -s, --silent            Do not show log messages.\n  -t, --title=\u003ctitle\u003e     Title of the document. If omitted, filename is used.\n  -V, --version           Print version information and exit.\n\nExit codes:\n  0    Successful PDF generation.\n  1    No PDF was generated.\n\nExamples:\nNotice that the default title of every document is the provided filename\n(in the examples below, the title of most documents is 'out'). To set an\nappropriate title different from the filename, use the option -t, as shown\nin the example 3.\n\n1. Include all Java and XML files on the current dir and its sub-dirs.\npric out.pdf -r -e java,xml\n\n2. Include all Markdown files and the LICENSE file found on the current\ndirectory.\npric out.pdf -e md -f 'LICENSE'\nNotice the single quotes around LICENSE. Always use single quotes around the\narg value of -f, to avoid the shell from evaluating the expression.\n\n3. Include all SQL files in current dir and add cover page with title and\nauthor.\npric out.pdf -e sql -a 'Hernan Cervera' -t 'Database design'\n\n4. Include all SQL files in current dir and remove cover page from PDF.\npric out.pdf -e sql -c\n```\n\n- By default, the PDF generated has one file per page. If you are dealing with many small files, this might not be ideal. The `--compact` option generates a PDF with no cover page, no ToC, and attempts to place more files per page.\n- If you would like to further customize the PDF, for example by adding a paragraph or some other information, you can use `--keep-asciidoc` to preserve the AsciiDoc file and manually edit it as you will. Then it is simple to generate your PDF by using [`asciidoctor-pdf`](https://github.com/asciidoctor/asciidoctor-pdf#install-the-published-gem).\n\n## Requirements\n\n- Groovy 3\n- Java 8\n\n## Installation\n\n### Linux\n\nDownload **[Pric](./pric)** and provide execution permission:\n\n```\nchmod +x pric\n```\n\nTo have the script globally available, copy it to `/usr/local/bin`.\n\n### Windows\n\n1. Make sure you have a shell which supports Bash, e.g. [Git Bash](https://gitforwindows.org/).\n2. Download **[Pric](./pric)** and you are done.\n3. (Optional but recommended) Make the script globally available by configuring your `PATH` environment variable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhernancerm%2Fpric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhernancerm%2Fpric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhernancerm%2Fpric/lists"}