For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ruby PDF library integration

Welcome to Apryse. Ruby for the Apryse SDK is supported on Linux and macOS. To get started, choose your preferred platform from the tabs below.

Ruby & macOS PDF library integration

There are two ways to use Apryse with Ruby on macOS:

  • Use the precompiled universal library for Ruby 2.6+.

  • Use PDFNet bindings to build your own wrappers.

To get started, please choose a tab below.

This guide will help you get started using the precompiled Ruby wrappers. You can run Apryse samples and integrate a free trial of the Apryse SDK into Ruby application on macOS. Your free trial includes unlimited trial usage and support from solution engineers.

Prerequisites

  • Ruby 2.6 - 2.7

  • Apryse precompiled Python/Ruby SDK for macOS:

curl -L -O https://downloads.apryse.com/downloads/PDFNetWrappersMac.zip
unzip PDFNetWrappersMac.zip

Run Apryse SDK in production

A commercial license key is required for use in a production environment. Please fill out our licensing form if you do not have a valid license key.

Initial setup

  1. Extract the downloaded zip file and navigate to it.

  2. Navigate to the /PDFNetC/Lib directory of the Python SDK download and execute:

sh ./fix_rpaths.sh
  1. Get your Apryse trial key.

spinner

Run the samples

Run a specific sample

  1. Navigate to the RUBY folder in the sample, for example /Samples/RUBY and execute ./RunTest.sh.

Run all samples

  1. To run all tests, navigate to /Samples and execute the runall_ruby file:

The tests will run one by one.

Output files will be in /Samples/TestFiles/Output

Integrate into your application

This section will show you how to use our SDK to create a simple Apryse "Hello World!" application. It will create a document with one blank page and save it as a linearized PDF in its running directory.

  1. Navigate to your /Samples directory and make a new directory called myApp (if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory inside myApp called RUBY.

  2. Navigate inside that RUBY folder and create a new Ruby file called myApp.rb. Open it with your favorite text editor and paste this into it:

Run your application by executing ruby myApp.rb. If all goes well, your console should output:

Check the output.pdf that the program output in the same directory. It should be a PDF with one blank page.

This guide will help you build your own PDFNet Ruby wrappers by binding a free trial of the PDFNetC library to Ruby. It will also show you how to run Apryse samples and integrate the Apryse SDK into Ruby applications on macOS. Your free trial includes unlimited trial usage and support from solution engineers.

Prerequisites

  • Ruby version 2.x - 3.2

  • CMake version ≥ 2.8

  • SWIG 2.0.4 - 2.0.12 or SWIG 3.0.12 or SWIG 4.0.2+ (Ruby 2.7+)

  • Download the Apryse PDF library for macOS:

Run Apryse SDK in production

A commercial license key is required for use in a production environment. Please fill out our licensing form if you do not have a valid license key.

Initial setup

  1. Make a directory to store the wrappers and navigate into that directory.

  2. Clone the PDFNet Wrappers project, select the correct branch for your release afterwards. This is typically a numbered release such as 11.11, 11.12, 11.13 and 12.0.

  1. Navigate to PDFNetWrappers/PDFNetC. Download the Apryse SDK using the method described in the Prerequisites section, and place the downloaded package in this directory and unzip it.

  2. Now, to move the headers in place, make sure you're in the PDFNetWrappers/PDFNetC directory and execute:

and

to move the PDFNet libraries in place.

You can delete PDFNetCMac.zip to free up space.

Your /PDFNetC folder should be laid out like this like this:

  1. Make a build directory inside /PDFNetWrappers and navigate to it. This guide will assume the build directory is called Build.

  2. Execute:

If all goes well, you should get a message that reads:

  1. Execute make followed by sudo make install.

  2. Next, we need to fix the rpaths issue on Mac. While still in the same Build directory, execute these lines:

  1. Get your Apryse trial key.

spinner

Run the samples

Run a specific sample

1. Navigate to the RUBY folder in the sample, for example /Samples/AddImageTest/RUBY and execute ./RunTest.sh

Run all Samples

  1. Navigate to /Samples and execute:

The tests will run one by one.

Output files will be in /Samples/TestFiles/Output

Integrate into your application

This section will show you how to use our SDK to create a simple Apryse "Hello World!" application. It will create a document with one blank page and save it as a linearized PDF in its running directory.

  1. Navigate to your /Samples directory and make a new directory called myApp (if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory inside myApp called RUBY.

  2. Navigate inside that RUBY folder and create a new Ruby file called myApp.rb. Open it with your favorite text editor and paste this into it:

Run your application by executing ruby myApp.rb. If all goes well, your console should output:

Check the output.pdf that the program output in the same directory. It should be a PDF with one blank page.

Ruby & Linux PDF library integration

This guide will help you build your own PDFNet Ruby wrappers by binding a free trial of the PDFNetC library to Ruby. It will also show you how to run Apryse samples and integrate the Apryse SDK into Ruby applications on Linux. Your free trial includes unlimited trial usage and support from solution engineers.

Prerequisites

  • Ruby version 2.x, 3.x

  • CMake version ≥ 2.8

  • SWIG 2.0.4 - 2.0.12 or SWIG 3.0.12 or SWIG 4.0.2 - 4.2.1 (Ruby 2.7+) or SWIG 4.3.0+ (Ruby 3.2+)

  • Download the Apryse Ruby SDK for Linux:

spinner
spinner

Or download from the command line:

Run Apryse SDK in production

A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.

Initial setup

  1. Create a directory to store the wrappers, then navigate into it.

  2. Clone the PDFNet Wrappers project, then select the correct branch for your release. This is typically a numbered release such as 11.11, 11.12, 11.13, and 12.0.

  1. Navigate to PDFNetWrappers/PDFNetC. Download the Apryse Ruby SDK using one of the methods described in the Prerequisites section, and place the downloaded package in this directory. Ensure the SDK architecture matches your Ruby interpreter (32-bit or 64-bit).

  2. Unpack PDFNetC64.tar.gz via tar xvzf PDFNetC64.tar.gz, then execute:

and

and move the PDFNet libraries in place. You can delete PDFNetC64.tar.gz to free up space. Your /PDFNetC folder should be laid out like this:

  1. Make a build directory inside /PDFNetWrappers and navigate to it. This guide will assume the build directory is called Build.

  2. Execute:

If all goes well, you should get a message that reads:

  1. Execute make followed by sudo make install. You are now ready to run the samples or integrate Apryse SDK into your own application.

  2. Get your Apryse trial key.

spinner

Run the samples

Run a specific sample

  1. Navigate to the RUBY folder in the sample, for example /Samples/AddImageTest/RUBY and execute ./RunTest.sh

Run all samples

  1. Navigate to /Samples and execute:

The tests will run one by one.

Output files will be in /Samples/TestFiles/Output

Integrate into your application

This section will show you how to use our SDK to create a simple Apryse "Hello World!" application. It will create a document with one blank page and save it as a linearized PDF in its running directory.

  1. Navigate to your /Samples directory and make a new directory called myApp (if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory inside myApp called RUBY.

  2. Navigate inside that RUBY folder and create a new Ruby file called myApp.rb. Open it with your favorite text editor and paste this into it:

  1. Run your application by executing ruby myApp.rb. If all goes well, your console should output:

Check the output.pdf that the program outputs in the same directory. It should be a PDF with one blank page.

Next step

GuidesSamples

Troubleshooting

Check the troubleshooting page and our PDFNetWrappers github if you run into any issues going through this document.

Last updated

Was this helpful?