Dragonfly PDF
Dragonfly PDF analysers and processors.
Dependencies
Installation
Add this line to your application's Gemfile:
gem 'dragonfly_pdf'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dragonfly_pdf
Usage
The analyser and processors are added by configuring the plugin
Dragonfly.app.configure do
plugin :pdf
end
Analysers
PDF properties
Reads properties from a PDF.
pdf.pdf_properties
It returns a hash of properties:
{
page_count: 4,
page_dimensions: [[210.0, 297.0], [210.0, 297.0], [210.0, 297.0], [210.0, 297.0]],
page_numbers: [1, 2, 3, 4],
widths: [210.0, 210.0, 210.0, 210.0],
heights: [297.0, 297.0, 297.0, 297.0],
aspect_ratios: [0.71, 0.71, 0.71, 0.71]
}
Processors
Page
Extracts page from PDF.
pdf.page(page_number=1)
Page Thumb
Generates thumbnail of a specified page, in defined density (dpi) and format.
pdf.page_thumb(page_number=1, opts={})
The available options and their default values are:
{
density: 600,
format: :png,
}
Subset Fonts
Subset fonts in PDF.
pdf.subset_fonts
Contributing
- Fork it ( https://github.com/tomasc/dragonfly_pdf/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request