I saw some similar questions on this forum but all those were for .NET
platform so please don't close it as duplicate. I have a linux system and I want to convert slide to images via php or shell script(less preferable). the convert
command can convert pdf to jpg's but not a ppt.
Any help would be great.
Click to open the Save as Type drop-down menu. Select one of the following image formats for your slide. Click Save. Review the PowerPoint dialog box, and select Just This One to save your selected slide as an image.
Change the "Save as Type" from PowerPoint Presentation to JPEG File Interchangeable Format. You will see a drop down list of file types to convert to. Scroll to the JPEG format and select it. Select the folder to save the presentation in.
Step 2: Export the slide as a picture In PowerPoint, open your slide presentation, and then open the slide that you want to export. On the File menu, select Save As. In the Save as type box, select one of the following picture formats: GIF Graphics Interchange Format (.
I was able to accomplish this by first converting the powerpoint file to pdf. This required me installing libre office on my server. Then converting the pdf to images is easily done using image magic. Here is some of my code. It uses https://github.com/ncjoes/office-converter (for the ppt to pdf conversion) and https://github.com/spatie/pdf-to-image (for the pdf to image conversion)
//now convert file to pdf
$converter = new OfficeConverter($newFile);
$result = $converter->convertTo('output.pdf');
$pdfFile = BASE_PATH.'/output.pdf';
//now convert pdf file to images
chdir(BASE_PATH);
//get total number of pages in pdf file
$pdf = new \Spatie\PdfToImage\Pdf($pdfFile);
$pdf->setCompressionQuality(80);
$pages = $pdf->getNumberOfPages();
for($i=1;$i<=$pages;$i++){
$pdf->setPage($i)->saveImage(BASE_PATH."/image$i.jpg");
}
http://code.google.com/p/jodconverter/ seems to have all the building blocks in place, there is even a sample webapp.
We used the old version at http://sourceforge.net/projects/jodconverter/ successfully some time ago, but thI really can't remember the details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With