Ruby Client Library
The DynamicPDF API provides a full‑featured client library for Ruby that simplifies integration with the REST endpoints.
The Ruby client library is the official SDK for integrating the DynamicPDF API into Ruby applications, scripts, and services. It provides familiar Ruby classes and methods that let developers generate PDF documents, convert HTML and images to PDF, merge multiple files, extract text and metadata, and perform detailed PDF inspection without hand-crafting Net::HTTP requests or managing low-level network handling.Through this library, Ruby developers can access the full capabilities of the DynamicPDF API, including creating PDFs programmatically, merging or splitting existing documents, filling and flattening interactive form fields, stamping text or images onto pages, retrieving XMP and document information, rasterizing PDF pages into images, and applying encryption or other security options. The DynamicPDF API delivers a complete set of PDF focused endpoints that support creation, conversion, manipulation, analysis, and secure delivery of PDF content within Ruby applications running on Rails, Sinatra, background jobs, or standalone scripts.
The DynamicPDF API offers clean, intuitive wrappers around the following REST endpoints:
dlex-layoutfor creating dynamic PDF reports from DLEX templates and JSON data,image-infofor extracting detailed metadata from images,pdffor creating and manipulating PDFs, merging documents, and converting HTML, Word, and Excel files to PDF,pdf-infofor retrieving document information and metadata from existing PDFs,pdf-security-infofor obtaining PDF encryption details and security settings,pdf-textfor extracting text content from PDF pages, andpdf-xmpfor reading embedded XMP metadata from PDF files.
Installation
gem install dynamicpdf_api
Usage Example
class GetPdfInfo
def self.run(apikey, path)
resource = PdfResource.new("#{path}fw4.pdf")
pdf_info = PdfInfo.new(resource)
pdf_info.api_key = apikey
response = pdf_info.process
if response.is_successful
puts response.json_content
else
puts response.error_json
end
end
end