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.zipInitial setup
Extract the downloaded zip file and navigate to it.
Navigate to the
/PDFNetC/Libdirectory of the Python SDK download and execute:
sh ./fix_rpaths.shGet your Apryse trial key.
Run the samples
Run a specific sample
Navigate to the
RUBYfolder in the sample, for example/Samples/RUBYand execute./RunTest.sh.
Run all samples
To run all tests, navigate to
/Samplesand execute therunall_rubyfile:
The tests will run one by one.
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.
Navigate to your
/Samplesdirectory and make a new directory calledmyApp(if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory insidemyAppcalledRUBY.Navigate inside that
RUBYfolder and create a new Ruby file calledmyApp.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
Download the Apryse PDF library for macOS:
Initial setup
Make a directory to store the wrappers and navigate into that directory.
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.13and12.0.
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.Now, to move the headers in place, make sure you're in the
PDFNetWrappers/PDFNetCdirectory 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:
Make a build directory inside
/PDFNetWrappersand navigate to it. This guide will assume the build directory is called Build.Execute:
If all goes well, you should get a message that reads:
Execute
makefollowed bysudo make install.Next, we need to fix the
rpathsissue on Mac. While still in the sameBuilddirectory, execute these lines:
Get your Apryse trial key.
You are now ready to run the samples or integrate Apryse SDK into your own application.
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
Navigate to
/Samplesand execute:
The tests will run one by one.
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.
Navigate to your
/Samplesdirectory and make a new directory calledmyApp(if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory insidemyAppcalledRUBY.Navigate inside that
RUBYfolder and create a new Ruby file calledmyApp.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
Download the Apryse Ruby SDK for Linux:
Or download from the command line:
Initial setup
Create a directory to store the wrappers, then navigate into it.
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, and12.0.
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).Unpack
PDFNetC64.tar.gzviatar 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:
Make a build directory inside
/PDFNetWrappersand navigate to it. This guide will assume the build directory is called Build.Execute:
If all goes well, you should get a message that reads:
Execute
makefollowed bysudo make install. You are now ready to run the samples or integrate Apryse SDK into your own application.Get your Apryse trial key.
Run the samples
Run a specific sample
Navigate to the
RUBYfolder in the sample, for example/Samples/AddImageTest/RUBYand execute./RunTest.sh
Run all samples
Navigate to
/Samplesand execute:
The tests will run one by one.
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.
Navigate to your
/Samplesdirectory and make a new directory calledmyApp(if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory insidemyAppcalledRUBY.Navigate inside that
RUBYfolder and create a new Ruby file calledmyApp.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 outputs in the same directory. It should be a PDF with one blank page.
Next step
Troubleshooting
Check the troubleshooting page and our PDFNetWrappers github if you run into any issues going through this document.
Last updated
Was this helpful?