I need to use a library I found on Github in an existing component, but my near non-existent knowledge of NAMESPACE is making it impossible.
To merge PDF files, I'm using the library at https://github.com/gabrielchavezme/pdf-table-of-content. The standalone code that works is below. However, when used within my Joomla controller or CLI scripts, everything crashes when it interferes with Joomla.
How can I use this library from with Joomla?
UPDATE: For POC, I did try it outside the controller class, and of course it was a total failure, which is when I tried it at the top of a CLI script, and had the same kind of problems. In short, I don't know where I should be trying to put it into Joomla.
namespace GabrielChavez\PdfTableOfContent; use GabrielChavez\PdfTableOfContent\Exceptions\FileNotFoundException; use GabrielChavez\PdfTableOfContent\Exceptions\NoFilesDefinedException; use GabrielChavez\PdfTableOfContent\PdfTableOfContent; use TCPDI; require_once ('libraries/pdfTOC/vendor/autoload.php'); $pdfMerge = new PdfTableOfContent(); $pdfMerge->add([ 'file' => '2018_01_08_RM_Exhibit_A.pdf', 'title' => 'File 1', 'id' => 1 ]); $pdfMerge->add([ 'file' => '2018_01_08_RM_Exhibit_B.pdf', 'title' => 'File 2', 'id' => 2 ]); $pdfMerge->merge('MyMergedPDF.pdf');