Class 使用 CloudConvert 使用 PHP 合并 PDF 时未发现错误

Class not found error when using CloudConvert to combine PDFs using PHP

我正在尝试使用 CloudConvert 将 3 个 PDF 合并为一个。我遵循了他们网站上的示例,但我不断收到 Class 'net\websitename\libraries\CloudConvert\Api' not found 错误。我不知道如何从这里开始。

这是我的代码:

public function combineInvoiceVoucherList($jobid) {
    // Using their files for testing
    $file1 = 'https://cloudconvert.com/assets/e214b299/testfiles/pdfexample1.pdf';
    $file2 = 'https://cloudconvert.com/assets/e214b299/testfiles/pdfexample2.pdf';
    require APPPATH . 'libraries/CloudConvert.class.php';

    $api = new Api('apikey');

    $process = $api->createProcess([
        'mode' => 'combine',
        'inputformat' => 'pdf',
        'outputformat' => 'pdf',
    ]);
    $process->start([
        'mode' => 'combine',
        'input' => 'download',
        'files' => [
            '0' => $file1,
            '1' => $file2,
        ],
        'outputformat' => 'pdf',
        'wait' => true,
    ]);
    $process->download('testingdownload.pdf');
}

我尝试使用:

require __DIR__ . '/vendor/autoload.php';
use \CloudConvert\Api;

$api = new Api('apikey');

$process = $api->createProcess([
    "mode" => "combine",
    "inputformat" => "pdf",
    "outputformat" => "pdf",
]);

但这只是给我带来了 404 页面未找到错误。

我在这方面很陌生,所以任何帮助将不胜感激。

我现在还有其他错误,但这是我尝试过的,它解决了 class not found 错误。

use net\websitename\libraries\CloudConvert\CloudConvert;

public function combineInvoiceVoucherList($jobid) {
    $file1 = 'https://cloudconvert.com/assets/e214b299/testfiles/pdfexample1.pdf';
    $file2 = 'https://cloudconvert.com/assets/e214b299/testfiles/pdfexample2.pdf';
    require APPPATH . 'libraries/CloudConvert.class.php';

    $api = new CloudConvert();

    $apikey = 'apikey';

    $process = CloudConvert::createProcess('pdf', 'pdf', $apikey);
    $this->session->set_flashdata('message', 'File combination started - reload job to view.');
    redirect('job/editjob/' . $jobid);
}