How to Convert a PDF File to PDF/A in Ruby

If you run into compatibility issues when attempting to share a PDF file, it may be helpful to convert the document into the universally standardized PDF/A format. In this brief tutorial, we will demonstrate how you can transform your PDF into a PDF/A using an API in Ruby. All you will need to complete the process are the target PDF file and your API key; there is an additional option that allows you to specify your level of conformance to PDF/A-1b or PDF/A-2b, depending on your needs. The default conformance level is PDF/A-1b.

To begin the process, we will add the Ruby client to our Gemfile:

gem 'cloudmersive-convert-api-client', '~> 2.1.6'

Next, we can input the parameters specified above in the code provided below:

# load the gem
require 'cloudmersive-convert-api-client'
# setup authorization
CloudmersiveConvertApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end

And that’s it! If you need to obtain an API key, you can register for a free account on the Cloudmersive website; this will also provide access to 800 monthly calls across our API library.

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.