将S3对象转换为PDF

I am trying to use PHP to show a pdf in browser that comes from an amazon S3 bucket. My code is as follows:

$object = $s3Client->getObject([
    'Bucket' => 'buckethere',
    'Key'    => 'keykhere'
]);

echo $object['Body'];

This just prints out a stream of random characters in browser, I am assuming I need to convert this stream of data to a PDF but have not found how to do that anywhere. Does PHP have a function that converts data to pdf format, or a php library that can do that?

EDIT: Getting same issue with trying to load photos as well.