0

I am writing a test function to read the number of pages in a PDF file. I have tried various methods, but the one I am working on now is giving me an error (Trying to get property of non-object) and I can't figure out why.

function testPageCount()
{
    $this->CI->load->library('Awss3', null, 'S3'); <-- this is where I get the error
    $this->CI->load->library('pdflib');
    $data = $this->CI->S3->readFile('uploads/171465/name.pdf', false, self::BUCKET);
    echo $data;

}

I have looked through all the code and everywhere else this library call is used, it's called exactly the same way. Any help or insight would be much appreciated.

EDIT: This is all the code in the function. I have not left anything out.

PortyR
  • 355
  • 1
  • 2
  • 12

1 Answers1

0

I added the following and that solved this problem:

$CI = &get_instance();
$CI->load->library('Awss3', null, 'S3');
$CI->load->library('Pdflib');
$data = $CI->S3->readFile('uploads/171465/name.pdf', false, self::BUCKET);
PortyR
  • 355
  • 1
  • 2
  • 12