Pludoni::Pdfutils
Installation
Add this line to your application's Gemfile:
gem 'pludoni-pdfutils'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pludoni-pdfutils
requires ghostscript installed.
Conversion of document formats (docx etc.) requires soffice installed
Usage
All method take either ActiveStorage::Blob or File/Tempfile as argument and return a Tempfile/File
Pludoni::Pdfutils.compress_if_large(file, max_size: 5.megabytes)
Pludoni::Pdfutils.convert_all_to_pdf_and_join_max_size(blobs, max_files: 3, max_size: 5.megabytes)
Individual classes:
tempfile = Pludoni::Pdfutils::ConvertImageToPdf.new(image_file).run
tempfile = Pludoni::Pdfutils::ConvertDocumentToPdf.new(image_file).run
tempfile = Pludoni::Pdfutils::Joiner.new(job_application.uploads.map(&:blob)).run
tempfile = Pludoni::Pdfutils::Compressor.new(pdf_file).run
License
The gem is available as open source under the terms of the MIT License.