Skip to content

Kadenze/viewerjs-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Viewerjs::Rails

This gem packages the Viewerjs assets (JavaScripts, stylesheets, and images) for the Rails asset pipeline, so you never have to download a custom package through the web interface again.

See VERSIONS.md to see which versions of viewerjs-rails bundle.

Installation

Add this line to your application's Gemfile:

gem 'viewerjs-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install viewerjs-rails

Usage

Load viewerjs from rails assets manifest file. Add the following to your application.js:

//= require viewerjs_rails

Add the following to your application.css:

/*
 *= require viewerjs_rails
 */

Add helper to embed blank viewer in specific controller's view:

  <%= viewerjs_viewer %>
  <%= viewerjs_viewer(viewer_alignment: 'left') %>
  <%= viewerjs_viewer(title: 'Some title') %>
  <%= viewerjs_viewer({viewer_alignment: 'right', title: 'Some title'}) %>

And visit the page with static pdf path in reference after #. Please note that changing pdf path after # in url will not refresh the page (from its current content) so better to add some random querystring or do hard reset like (Ctrl+F5 or Command+R):

http://localhost:3000/#test.pdf
http://localhost:3000/?1=2#test.pdf

Contributing

  1. Fork it ( https://github.com/praveenkumarsinha/viewerjs-rails/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

Limitations

  • Only pdf can be viewed in browser for the time being. Once it becomes possible to load doc or odt file will package them here in this gem.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 78.6%
  • JavaScript 12.5%
  • SCSS 7.3%
  • Other 1.6%