https://github.com/uminocelo/koralreef
A tool to scrape images from websites and compile them into a PDF
https://github.com/uminocelo/koralreef
pdf pdf-generation ruby ruby-gem ruby-on-rails rubygem rubygems
Last synced: about 2 months ago
JSON representation
A tool to scrape images from websites and compile them into a PDF
- Host: GitHub
- URL: https://github.com/uminocelo/koralreef
- Owner: uminocelo
- License: mit
- Created: 2025-03-03T04:48:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-15T18:52:26.000Z (about 1 year ago)
- Last Synced: 2025-10-15T21:29:08.017Z (8 months ago)
- Topics: pdf, pdf-generation, ruby, ruby-gem, ruby-on-rails, rubygem, rubygems
- Language: Ruby
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Koral Reef 🪸
A Ruby gem that scrapes images from websites (including JavaScript-heavy ones) and compiles them into a PDF.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'koralreef'
```
And then execute:
```bash
$ bundle install
```
Or install it yourself as:
```bash
$ gem install koralreef
```
## Usage
### Command Line
```bash
# Basic usage (scrapes all images)
$ koralreef https://example.com/gallery
# Scrape specific images with a CSS selector
$ koralreef -s ".product-image" https://example.com/products
# Specify output file
$ koralreef -o product_catalog.pdf https://example.com/products
# Run with visible browser (not headless)
$ koralreef --no-headless https://example.com/gallery
```
### In Ruby Code
```ruby
require 'koralreef'
# Basic usage
pdf_file = Koralreef.run(
url: "https://example.com/gallery",
selector: "img.gallery-image",
output_file: "gallery.pdf",
headless: true
)
puts "PDF created at: #{pdf_file}"
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/uminocelo/koralreef.
## License
The gem is available as open source under the terms of the MIT License.