Quick Verification
The release package provides samples/demo/demo.js as the sample entry point. With no input PDFs, the sample converts the bundled PDFs under samples/input_files to Word, Excel, PowerPoint, CSV, HTML, RTF, image, TXT, JSON, Markdown, searchable PDF, and OFD outputs under samples/output_files.
cd /path/to/compdfkit_conversion_node
node samples/demo/demo.jsExpected key output:
licenseVerify => 0
version => 4.1.0
setDocumentAIModel => 0
pdf to word: result=0, output=...
all conversion tasks finishedMulti-file Demo
The sample also supports multi-file conversion. Each worker process initializes the SDK independently.
cd /path/to/compdfkit_conversion_node
node samples/demo/demo.js \
--threads 2 \
samples/input_files/word.pdf \
samples/input_files/excel.pdfBy default, the sample writes conversion results to samples/output_files. Use --output only when you want to write results to another directory.
The sample uses samples/license.xml by default. Override it with --license or COMPDFKIT_LICENSE when testing another license XML path or license key.
node samples/demo/demo.js \
--license /path/to/license.xml \
samples/input_files/word.pdfThe sample loads the packaged DocumentAI model by default:
resource/models/documentai.modelOverride it with --model or COMPDFKIT_MODEL_PATH:
node samples/demo/demo.js \
--model /path/to/documentai.model \
--threads 2 \
samples/input_files/word.pdf3. Conversion Guides
ComPDF Conversion SDK allows developers to use a simple API to convert PDF to common file formats like Word, Excel, PPT, HTML, CSV, PNG, JPEG, RTF, TXT, Searchable PDF, OFD, JSON, and Markdown. It provides a wide range of customized conversion options, such as whether to include images or annotations in PDF documents, whether to enable OCR, whether to enable layout analysis, and more.
All Node.js conversion APIs follow the same basic signature:
const result = sdk.startPDFToWord(
inputFilePath,
password,
outputFilePath,
options,
callback
);password can be an empty string when the input PDF is not encrypted. Each conversion method returns an SDK error code. 0 means the conversion succeeded.