3

I'm using container ubuntu 18.04 and want use pdtk

I found this

https://github.com/mnuessler/docker-pdftk

how i can use this pdtk in other container ?

when i add

docker-compose

version: "3.1"
services:
  pdftk:
    build: docker/pdf-tk
    working_dir: /application
    volumes:
      - .:/application


  php:
    build: docker/php-fpm # this is 18.04 and php
    working_dir: /application
    volumes:
      - .:/application

when i start

i get

pdftk_1_115fe12f025a exited with code 0

in log i see

SYNOPSIS


       pdftk <input PDF files | - | PROMPT>


        [ input_pw <input PDF owner passwords | PROMPT> ]


        [ <operation> <operation arguments> ]


        [ output <output filename | - | PROMPT> ]


        [ encrypt_40bit | encrypt_128bit ]


        [ allow <permissions> ]


        [ owner_pw <owner password | PROMPT> ]


        [ user_pw <user password | PROMPT> ]


        [ flatten ] [ need_appearances ]


        [ compress | uncompress ]


        [ keep_first_id | keep_final_id ] [ drop_xfa ] [ drop_xmp ]


        [ verbose ] [ dont_ask | do_ask ]


       Where:


        <operation> may be empty, or:


        [ cat | shuffle | burst | rotate |


          generate_fdf | fill_form |


          background | multibackground |


          stamp | multistamp |


          dump_data | dump_data_utf8 |


          dump_data_fields | dump_data_fields_utf8 |


          dump_data_annots |


          update_info | update_info_utf8 |


          attach_files | unpack_files ]




       For Complete Help: pdftk --help

How i can connect to pdftk from other container ?

When i try add to Dockerfile pdftk

ENTRYPOINT ["/bin/bash"]

still have

pdftk_1_115fe12f025a exited with code 0

If i understand i need run in this container some daemon - how to setup it to I can connect from other container to this and use pdftk app ?

UPDATE 2

Ok i found way to install pdftk in ubuntu 18.04 container

RUN apt-get -y install libbcprov-java libcommons-lang3-java default-jre-headless


RUN cd /tmp
RUN wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/p/pdftk-java/pdftk-java_3.0.2-2_all.deb
RUN dpkg -i pdftk-java_3.0.2-2_all.deb
Developer
  • 2,731
  • 2
  • 41
  • 71
  • It doesn't look like pdftk is a daemon -- it's not a server, it's a single-shot linux tool that you invoke when you need it. It runs, converts files, then exits. So, you can't use it this way. – Software Engineer May 31 '19 at 09:54
  • So how connect it ? eailer i use $cmd = 'pdftk "'.$file.'" multistamp "'.$watermarkFile.'" output '.$outFile; - in php container , but in 18.04 pdfth have problems to start – Developer May 31 '19 at 09:57
  • You can't. Not from where you are. You'd have to do Docker-in-Docker to use a docker container from within a container, which means having docker installed in the container, and sharing the docker-socket. You're better off just using pdftk directly, without it being in a container, and working through the problems you mentioned. – Software Engineer May 31 '19 at 10:01
  • I try 3 ways from https://askubuntu.com/questions/1028522/how-can-i-install-pdftk-in-ubuntu-18-04-and-later - to install pdftk in container - without success ... – Developer May 31 '19 at 10:09

0 Answers0