PSPDFKit gem for rubymotion

I’ve just released simple gem to include PSPDFKit into rubymotion project – see

Installation is pretty straightforward

add to your Rakefile :

require 'rubygems'
require 'bundler'

Create Gemfile file and add:

source :rubygems

gem 'pspdfkit'

and execute bundle install .

Then you need to copy/link framework and bundle files:

mkdir vendor
cd vendor
ln -s ../../pdf/Products/PSPDFKit.embeddedframework/PSPDFKit.framework ./
cd ../resources
ln -s ../../pdf/Products/PSPDFKit.embeddedframework/Resources/PSPDFKit.bundle ./

That’s it. Run rake and test your installation.

PSPDFKit in rubymotion


If you’re using Bundler, you can simply add gem ‘pspdfkit’ to your Gemfile. See more on

As I’ve started using this famous framework, I’d like to use it in my rubymotion application. So, there’s my setup to include this fmw in rubymotion project

  • extract PSPDFKit anywhere
  • create directory vendor  in your RM project
  • create symbolic link from your unzipped PSPDFKit to vendor/PSPDFKit.framework
cd vendor
ln -s ../../pdf/Products/PSPDFKit.embeddedframework/PSPDFKit.framework ./
cd ../resources
ln -s ../../pdf/Products/PSPDFKit.embeddedframework/Resources/PSPDFKit.bundle ./

and modify Rakefile accordingly

app.vendor_project('vendor/PSPDFKit.framework', :static, products: ['PSPDFKit'], headers_dir: 'Headers')

app.libs << '/usr/lib/libz.1.1.3.dylib'

app.frameworks += %w(MessageUI AssetsLibrary MediaPlayer PSPDFKit)

try rake , it should link and start simulator.

Next step

Add some PDF file into your app resources  folder.

And then you can try to modify app/app_delegate.rb  with simple example:

class AppDelegate
  def application(application, didFinishLaunchingWithOptions:launchOptions)

    documentURL = NSBundle.mainBundle.resourceURL.URLByAppendingPathComponent "DevelopersGuide.pdf"
    @document = PSPDFDocument.PDFDocumentWithURL documentURL

    pdfController = PSPDFViewController.alloc.initWithDocument @document
    navController = UINavigationController.alloc.initWithRootViewController pdfController

    @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)

    @window.rootViewController = navController