#!/usr/bin/perl -w # creates a Open Office Impress presentation from a list of images # Copyright (C) 2005 Karl-Heinz Herrmann # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Usage Hints # to convert a pdf into a odp file first create images of each slide: # gs -dNOPAUSE -r200 -sDEVICE=pngalpha -sOutputFile=testoutput_%d.png -dBATCH file.pdf # # For LaTeX beamer slides these option produce exactly the right size for 1024x768 target size #gs -dNOPAUSE -g1024x768 -r205 -sDEVICE=pngalpha \ # -sOutputFile=/tmp/testpngalpha_%d.png -dBATCH BeamerTalk.pdf use OpenOffice::OODoc; if ((@ARGV <1) or (@ARGV > 2)){ print << "EOF"; Usage: img2ooImpress.pl ImageFileList [outputfile.odp] ImageFileList is a file containing all images to import EOF exit; } my $outputfile; my $imgFileList=shift; $outputfile="img2ooImpressExport.odp" unless $outputfile=shift; open (IN,"<$imgFileList") or die "Can't read $imgFileList\n"; my $document = ooDocument ( file => $outputfile, create => 'presentation', member => 'content' ); $document->createImageStyle("slide"); my $i=1; while (my $imgfile=){ chomp($imgfile); my $test= $document->appendElement ('//office:presentation',0,'draw:page'); # print "append-element return: $test\n"; my $image= $document->createImageElement ( "Slide".$i, description => "image ".$i." filename:".$imgfile, page => $test, position => "0,0", import => $imgfile, size => "28cm, 21cm", style => "slide" ); # print "create image return: $image\n"; $i++; } $document->save;