PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
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.
cd /path/to/linux-x86_64
ruby samples/demo/demo.rbYou can also pass custom inputs and output directory:
ruby samples/demo/demo.rb \
--output /tmp/compdf_ruby_demo_out \
/path/to/input.pdfYou can pass license information through command-line options:
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.pdfOr through environment variables:
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.pdfThe demo defaults to the package resources when arguments are not provided:
samples/license.xml, or COMPDFKIT_LICENSE / COMPDF_LICENSE_KEY.resource/models/documentai.model, or COMPDFKIT_MODEL_PATH.samples/input_files/word.pdf, samples/input_files/excel.pdf, and samples/input_files/powerpoint.pdf.samples/output_files.The demo.rb sample also demonstrates multi-process PDF to Word conversion when explicit input PDFs are provided.
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.pdfTo load a different DocumentAI model in the demo, pass --model:
ruby samples/demo/demo.rb \
--output /tmp/compdf_ruby_demo_out \
--model /path/to/documentai.model \
/path/to/input.pdf