Skip to content
ComPDF

How to Run a Demo

Linux

The Ruby SDK release package provides samples/demo/demo.rb. Run the commands from the package root directory that contains doc/, lib/, resource/, and samples/. When no input PDFs are specified, the demo converts the packaged sample PDFs in samples/input_files and writes output files to samples/output_files.

shell
cd /path/to/linux-x86_64
ruby samples/demo/demo.rb

You can also pass custom inputs and output directory:

shell
ruby samples/demo/demo.rb \
  --output /tmp/compdf_ruby_demo_out \
  /path/to/input.pdf

You can pass license information through command-line options:

shell
ruby samples/demo/demo.rb \
  --license /path/to/license.xml \
  --device-id DEVICE_ID \
  --app-id com.example.application \
  --output /tmp/compdf_word_out \
  /path/to/input.pdf

Or through environment variables:

shell
export COMPDFKIT_LICENSE="/path/to/license.xml"
export COMPDFKIT_DEVICE_ID="DEVICE_ID"
export COMPDFKIT_APP_ID="com.example.application"
ruby samples/demo/demo.rb --output /tmp/compdf_word_out /path/to/input.pdf

The demo defaults to the package resources when arguments are not provided:

  • License: samples/license.xml, or COMPDFKIT_LICENSE / COMPDF_LICENSE_KEY.
  • DocumentAI model: resource/models/documentai.model, or COMPDFKIT_MODEL_PATH.
  • Input PDFs: samples/input_files/word.pdf, samples/input_files/excel.pdf, and samples/input_files/powerpoint.pdf.
  • Output directory: samples/output_files.

The demo.rb sample also demonstrates multi-process PDF to Word conversion when explicit input PDFs are provided.

shell
ruby samples/demo/demo.rb \
  --license /path/to/license.xml \
  --output /tmp/compdf_ruby_demo_out \
  --threads 2 \
  samples/input_files/word.pdf \
  samples/input_files/excel.pdf

To load a different DocumentAI model in the demo, pass --model:

shell
ruby samples/demo/demo.rb \
  --output /tmp/compdf_ruby_demo_out \
  --model /path/to/documentai.model \
  /path/to/input.pdf