{"id":13850592,"url":"https://github.com/gdelugre/origami","last_synced_at":"2025-04-08T08:12:46.604Z","repository":{"id":54854890,"uuid":"66081088","full_name":"gdelugre/origami","owner":"gdelugre","description":"Origami is a pure Ruby library to parse, modify and generate PDF documents.","archived":false,"fork":false,"pushed_at":"2023-02-21T14:51:50.000Z","size":581,"stargazers_count":309,"open_issues_count":40,"forks_count":112,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-04-26T09:46:31.720Z","etag":null,"topics":["parser","pdf","ruby","writer"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gdelugre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING.LESSER","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-08-19T12:32:55.000Z","updated_at":"2024-04-03T12:43:25.000Z","dependencies_parsed_at":"2024-01-18T09:57:59.322Z","dependency_job_id":"65ed38c4-4f48-4cdd-8ec4-d626ddc3331c","html_url":"https://github.com/gdelugre/origami","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdelugre%2Forigami","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdelugre%2Forigami/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdelugre%2Forigami/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdelugre%2Forigami/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gdelugre","download_url":"https://codeload.github.com/gdelugre/origami/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801169,"owners_count":20998339,"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":["parser","pdf","ruby","writer"],"created_at":"2024-08-04T20:01:19.863Z","updated_at":"2025-04-08T08:12:46.576Z","avatar_url":"https://github.com/gdelugre.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"Origami\n=====\n[![Gem Version](https://badge.fury.io/rb/origami.svg)](https://rubygems.org/gems/origami)\n[![Downloads](https://img.shields.io/gem/dt/origami.svg)](https://rubygems.org/gems/origami)\n[![Build Status](https://secure.travis-ci.org/gdelugre/origami.svg?branch=master)](https://travis-ci.org/gdelugre/origami)\n[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)\n\nOverview\n--------\n\nOrigami is a framework written in pure Ruby to manipulate PDF files.\n\nIt offers the possibility to parse the PDF contents, modify and save the PDF\nstructure, as well as creating new documents.\n\nOrigami supports some advanced features of the PDF specification:\n\n  * Compression filters with predictor functions\n  * Encryption using RC4 or AES, including the undocumented Revision 6 derivation algorithm\n  * Digital signatures and Usage Rights\n  * File attachments\n  * AcroForm and XFA forms\n  * Object streams\n\nOrigami is able to parse PDF, FDF and PPKLite (Adobe certificate store) files.\n\nRequirements\n------------\n\nAs of version 2, the minimal version required to run Origami is Ruby 2.1.\n\nSome optional features require additional gems:\n\n  * [therubyracer][the-ruby-racer] for JavaScript emulation of PDF scripts\n\nQuick start\n-----------\n\nFirst install Origami using the latest gem available:\n\n    $ gem install origami\n\nThen import Origami with:\n\n```ruby\nrequire 'origami'\n```\n\nTo process a PDF document, you can use the ``PDF.read`` method:\n\n```ruby\npdf = Origami::PDF.read \"something.pdf\"\n\nputs \"This document has #{pdf.pages.size} page(s)\"\n```\n\nThe default behavior is to parse the entire contents of the document at once. This can be changed by passing the ``lazy`` flag to parse objects on demand.\n\n```ruby\npdf = Origami::PDF.read \"something.pdf\", lazy: true\n\npdf.each_page do |page|\n    page.each_font do |name, font|\n        # ... only parse the necessary bits\n    end\nend\n```\n\nYou can also create documents directly by instanciating a new PDF object:\n\n```ruby\npdf = Origami::PDF.new\n\npdf.append_page\npdf.pages.first.write \"Hello\", size: 30\n\npdf.save(\"example.pdf\")\n\n# Another way of doing it\nOrigami::PDF.write(\"example.pdf\") do |pdf|\n    pdf.append_page do |page|\n        page.write \"Hello\", size: 30\n    end\nend\n```\n\nTake a look at the [examples](examples) and [bin](bin) directories for some examples of advanced usage.\n\nTools\n-----\n\nOrigami comes with a set of tools to manipulate PDF documents from the command line.\n\n  * [pdfcop](bin/pdfcop): Runs some heuristic checks to detect dangerous contents.\n  * [pdfdecompress](bin/pdfdecompress): Strips compression filters out of a document.\n  * [pdfdecrypt](bin/pdfdecrypt): Removes encrypted contents from a document.\n  * [pdfencrypt](bin/pdfencrypt): Encrypts a PDF document.\n  * [pdfexplode](bin/pdfexplode): Explodes a document into several documents, each of them having one deleted resource. Useful for reduction of crash cases after a fuzzing session.\n  * [pdfextract](bin/pdfextract): Extracts binary resources of a document (images, scripts, fonts, etc.).\n  * [pdfmetadata](bin/pdfmetadata): Displays the metadata contained in a document.\n  * [pdf2ruby](bin/pdf2ruby): Converts a PDF into an Origami script rebuilding an equivalent document (experimental).\n  * [pdfsh](bin/pdfsh): An IRB shell running inside the Origami namespace.\n\n**Note**: Since version 2.1, [pdfwalker][pdfwalker-gem] has been moved to a [separate repository][pdfwalker-repo].\n\nLicense\n-------\n\nOrigami is distributed under the [LGPL](COPYING.LESSER) license.\n\nCopyright © 2019 Guillaume Delugré.\n\n[the-ruby-racer]: https://rubygems.org/gems/therubyracer\n[pdfwalker-gem]: https://rubygems.org/gems/pdfwalker\n[pdfwalker-repo]: https://github.com/gdelugre/pdfwalker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdelugre%2Forigami","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgdelugre%2Forigami","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdelugre%2Forigami/lists"}