{"id":19474585,"url":"https://github.com/tomasc/dragonfly_phantomjs","last_synced_at":"2025-04-25T12:31:52.178Z","repository":{"id":18452346,"uuid":"21645867","full_name":"tomasc/dragonfly_phantomjs","owner":"tomasc","description":"Dragonfly PhantomJS plugin that converts .html or .svg to .gif, .jpeg, .pdf or .png.","archived":false,"fork":false,"pushed_at":"2017-06-12T15:20:45.000Z","size":27,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T22:23:11.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomasc.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}},"created_at":"2014-07-09T08:59:36.000Z","updated_at":"2017-08-18T09:54:48.000Z","dependencies_parsed_at":"2022-09-11T20:12:22.456Z","dependency_job_id":null,"html_url":"https://github.com/tomasc/dragonfly_phantomjs","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/tomasc%2Fdragonfly_phantomjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_phantomjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_phantomjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_phantomjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasc","download_url":"https://codeload.github.com/tomasc/dragonfly_phantomjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250817803,"owners_count":21492226,"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":[],"created_at":"2024-11-10T19:25:44.311Z","updated_at":"2025-04-25T12:31:51.847Z","avatar_url":"https://github.com/tomasc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dragonfly PhantomJS\n\n[![Build Status](https://travis-ci.org/tomasc/dragonfly_phantomjs.svg)](https://travis-ci.org/tomasc/dragonfly_phantomjs) [![Gem Version](https://badge.fury.io/rb/dragonfly_phantomjs.svg)](http://badge.fury.io/rb/dragonfly_phantomjs) [![Coverage Status](https://img.shields.io/coveralls/tomasc/dragonfly_phantomjs.svg)](https://coveralls.io/r/tomasc/dragonfly_phantomjs)\n\nThis [Dragonfly](https://github.com/markevans/dragonfly) plugin uses [PhantomJS](https://github.com/ariya/phantomjs) headless browser to convert `HTML` or `SVG` documents to `GIF`, `JPEG`, `PDF` or `PNG`\n\nIf passed an `SVG` and the `viewport_size` is not specified in the options, the `viewport_size` is automatically set to the dimensions of the `SVG` file.\n\nIMPORTANT: Requires [PhantomJS](http://phantomjs.org)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'dragonfly_phantomjs'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install dragonfly_phantomjs\n\n## Usage\n\nAdd the plugin to Dragonfly:\n\n```ruby\nDragonfly.app.configure do\n  plugin :phantomjs\nend\n```\n\n## Rasterize\n\n```ruby\nhtml.rasterize(format, options)\nsvg.rasterize(format, options)\n```\n\nFormats: `:gif`, `:jpeg`, `:pdf`, `:png`\n\nOptions:\n```Ruby\n:border         - {number, string}, defaults to 0, supported units are 'mm', 'cm', 'in', 'px'\n:format         - {string}, defaults to 'A4', supported formats are 'A4', 'A3', 'A5', 'Legal', 'Letter', 'Tabloid'\n:paper_size     - {string}, 'width*height', '300mm*300mm', supported units are 'mm', 'cm', 'in', 'px'\n:viewport_size  - {string}, 'width*height', '1440*900'\n:zoom_factor    - {number}, defaults to 1\n:header         - {hash}, {height: '10mm', content: 'Header content', hide_on: [1]}\n:footer         - {hash}, {height: '10mm', content: 'Footer content', hide_on: [1]}\n```\n\nFor now refer to the phantomjs [api](http://phantomjs.org/api/webpage/property/paper-size.html) for more details on how to construct the string for the header/footer. You can use `pageNum` and `numPages` as variables. The `hide_on` option takes an array of page numbers where the header and/or footer will be hidden.\n\n## Contributing\n\n1. Fork it ( https://github.com/tomasc/dragonfly_phantomjs/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fdragonfly_phantomjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasc%2Fdragonfly_phantomjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fdragonfly_phantomjs/lists"}