Project

pdfjs

0.0
No commit activity in last 3 years
No release in over 3 years
PDFJS rails integration
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.0.0
 Project Readme

Build Status Gem Version

PDFJS Information

PDFJS is a RAILS ENGINE plugin for integrating the PDFJS into the RAILS applications.

  • Is a RAILS ENGINE;
  • Is composing of PDFJS images, javascripts and stylesheets;
  • Is contains PDFJS HTML layout;

Installation

Add this line to your application's Gemfile (Rails):

gem 'pdfjs'

And then execute:

$ bundle
  • Create a separate controller inherited from Pdfjs::PdfjsController

    class PDFController < PdfjsController
    end
  • Define your action. EX: show.

    class PDFController < PdfjsController
      def show
        @pdfjs_file = 'http://yoursite.com/pdfjs.pdf'
      end
    end
  • Create the show template and set the PDF file path

    <%= content_for :pdfjs do %>
      <%= javascript_tag do %>
        window.DEFAULT_URL = '<%= @pdfjs_file.html_safe %>';
      <% end %>
    <% end %>

Example applications

Contribution

Feel free to give pull request if you interested to fix some issues/features. Thanks.