If you have multiple format files like Image files(Eg. .png, .jpg, .jpeg etc.), Document files(Eg. .doc, .docx, text etc.)
or PDF files and now you want to make a single PDF with all format of files,
this gem will help you to compile multiple format files into single pdf.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install compile_pdf
Currently this is only supported with following format files:--
- Image Files(Eg. .PNG, .JPG, .JPEG etc.)
- PDF files(Eg. .pdf)
- Text and Note files(Eg. .txt etc. )
- Document files(Eg. .docx, .doc etc.)
Open Rails console:-
compile_pdf_module(file_array, attachment_object_name, file_name = nil)
file_array: Take the required files which you want to convert into a pdf
attachment_object_name: If you are using PaperClip as File uploader module
Then your attachment_object_name will be "attachment"
file_name: Default will be Time.now or else you can specify your own PDF name.
file_array = File.all
In your File model if
attachment_object_name = "attachment"
file_name = "my_attachment"
compile_pdf_module(file_array, attachment_object_name, file_name)
Default file location will be Your Project root folder "tmp/" folder
I have tested with PaperClip and Aws S3 and its working fine.
Soon I will release for "Dragonfly", "attachment_fu" and "CarrierWave" attachment gem.
This gem is highly dependent on :-
- gem "yomu", "~> 0.1.9" , :platforms => :ruby
- gem "prawn", "~> 1.0.0.rc2" , :platforms => :ruby
If you have any other version of Prawn it may conflict with 'Compile Pdf' gem.
- Fork it
- 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 new Pull Request