I want to export google slide presentation en pdf format using g-slide api, I used this Google api function:
$fileId = '1ZdR3L3qP4Bkq8noWLJHSr_iBau0DNT4Kli4SxNc2YEo';
$response = $driveService->files->export($fileId, 'application/pdf', array('alt' => 'media' ));
$content = $response->getBody()->getContents();
When I do print_r($content)
I can see the pdf code. But how I can display the $content
on pdf file, that can I saved on local machine ?.
I solve the problem like that:
$driveService = new \Google_Service_Drive($client);
$response = $driveService->files->export($presentation_id, 'application/pdf', array('alt' => 'media' ));
$content = $response->getBody()->getContents();
$filename = str_replace(" ", "-", 'pdf_name.pdf');
file_put_contents($upload_dir['path'].'/'.$filename, $content);
$upload_dir['path']
is a folder project path for me.