Skip to content
ComPDF

Cancel Conversion Task

ComPDF Conversion SDK supports interrupting an ongoing conversion task. Return true from isCancelled() to cancel the current task, or false to continue.

js
let cancelRequested = false;

const callback = {
  isCancelled() {
    return cancelRequested;
  }
};

The current addon calls JavaScript callbacks synchronously from the conversion call thread. If the native SDK triggers callbacks from internal worker threads in the future, the addon must use napi_threadsafe_function instead of direct napi_call_function().