Dockerfile supports conversion of powerpoint to image and word document conversion to pdf using unoconv package and imagemagic convert function.
Supporting office document conversion (powerpoint/excel/word) now is easy with opening a shell/system command from language of preference, for e.g. in this one I am installing php and fpm along with nginx to install the webserver.
You can run the docker container and then login into to convert a file
docker run -it --memory 3g -v /<MAP_HOST_DIR>:/var/www pg2286/ppt-to-image:v2 /bin/bash
Now change directory to /var/www and assuming 477.pptx file is present run the below command .
This command will convert a given pptx for e.g. 477.pptx into a pdf file with the same name 477.pdf
unoconv --export Quality=100 -f pdf 477.pptx
once converted we can run the imagemagic convert command to convert the compressed jpg
convert -density 260 -gaussian-blur 0.05 -resize 50% -trim large_ppt.pdf -quality 85% density_260_large/large_ppt_%03d.jpg
#Word document to pdf #unoconv --export Quality=100 -f pdf doc/PranavGarg.docx
FROM ubuntu:20.04
MAINTAINER = Pranav Garg
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y unoconv imagemagick
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y awscli jq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y php-fpm php-amqp composer nginx php-imagick
RUN sed -i_bak \
's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' \
/etc/ImageMagick-6/policy.xml
RUN sed -i \
's/name="memory" value="256MiB"/name="memory" value="1GiB"/' \
/etc/ImageMagick-6/policy.xml
RUN sed -i \
'/<policy domain="resource" name="disk" value="1GiB"*/c <!-- <policy domain="resource" name="disk" value="1GiB"/> -->/' \
/etc/ImageMagick-6/policy.xml
RUN sed -i \
's/name="map" value="512MiB"/name="map" value="756MiB"/' \
/etc/ImageMagick-6/policy.xml
Content type
Image
Digest
Size
363.7 MB
Last updated
almost 6 years ago
docker pull pg2286/ppt-to-image:v1