0.01
Low commit activity in last 3 years
No release in over a year
Dragonfly PDF analysers and processors.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Dragonfly PDF

Build Status Gem Version Coverage Status

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

Supported Formats

List of supported formats is available as:

DragonflyPdf::SUPPORTED_FORMATS # => ["pdf"]
DragonflyPdf::SUPPORTED_OUTPUT_FORMATS # => ["pdf", "svg", …]

Analysers

PDF properties

Reads properties from a PDF.

pdf.pdf_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],
    aspect_ratios: [0.71, 0.71, 0.71, 0.71],
    page_rotations: [0.0, 90.0, 0.0, 0.0]
}

Processors

Append

Append PDFs.

pdf.append([pdf_1, pdf_2, pdf_3])

Page

Extracts page from PDF.

pdf.page(page_number=1)

Page Thumb

Generates thumbnail of a specified page using the thumb processor of DragonflyLibvips.

pdf.page_thumb(page_number=1, '500x', opts={})

The default format is png, others can be specified

{
    'format' => 'jpg',
}

For more options see the thumb doc.

Remove password

Remove password from password protected PDF.

pdf.remove_password

Rotate

Rotate all pages.

pdf.rotate(:left)

Rotate selected pages.

pdf.rotate(1 => :left, 3 => :right)

absolute: north|south|east|west relative: left|right|down

Stamp

Stamp every page of a PDF with another PDF.

pdf.stamp(stamp_pdf)

Subset Fonts

Subset fonts in PDF.

pdf.subset_fonts

Contributing

  1. Fork it ( https://github.com/tomasc/dragonfly_pdf/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request