Skip to content

Commit

Permalink
AAdd Rails helper to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgessler committed Feb 28, 2024
1 parent 79f6d81 commit 165e055
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ end
MyPage.new(title: "This is a PDF!").to_pdf
```

### Rails integration

To stream PDFs from Rails controllers, the `send_pdf` helper that wraps `send_data` and renders the PDF is available.

```ruby
class MyController < ApplicationController
include Phlex::PDF::Rails::Helpers

def show
send_pdf MyPage.new(title: "This is a PDF!")
end
end
```

## 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.
Expand Down

0 comments on commit 165e055

Please sign in to comment.