Skip to content

Agowan/pdftool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PdfTool

This was created when I had to much problems with other known pdf tool libraries for merging and create pdf files from html.

This gem are using following java libs pdf-merger and html-to-pdf

Compatibility

This gem is tested on rails 4.0.5 with ruby 2.1.1

Install

At the moment before any tests are written and tested in production install it from github

gem 'pdftool', github: "agowan/pdftool"

Generate html to pdf

Without fonts

generator = Pdf::Generator.new "<body><strong>Hello World</strong></body>"
generator.save('path/to/file.pdf')

With fonts

generator = Pdf::Generator.new "<body><strong>Hello World</strong></body>", "path/to/font1.ttf", "path/to/font2.ttf"
generator.save('path/to/file.pdf')
# Returns the pdf inline
generator.to_pdf

Merge existing pdf files from disk

merger = Pdf::Merger.new 'path/to/file_1.pdf', 'path/to/file_2.pdf'
merger.save('path/to/file.pdf')

You can also get the file inline.

merger.to_pdf

Contributing

  • For it
  • Add your code
  • Create a pull request

About

Merge existing pdf:s and generate pdfs from html.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages