-
Install x11docker
-
Run PDFEdit, e.g
x11docker --share "$PWD" ghcr.io/bmaupin/pdfedit
ⓘ
--share "$PWD"
will share your current directory with PDFEdit so you can see files from your PC
This is a lot more complicated and not secure.
There are many ways to do this, here's just one example:
-
CD to the directory containing the PDF to edit
-
Run PDFEdit
xhost +; docker run --rm -v "$PWD:/workdir" -e DISPLAY=$DISPLAY -v "$HOME/.Xauthority:/root/.Xauthority:rw" --net=host ghcr.io/bmaupin/pdfedit; xhost -
This is the Dockerfile that was used to create the ghcr.io/bmaupin/pdfedit
image:
FROM ubuntu:12.04
WORKDIR /workdir
# Change the default shell to bash
SHELL ["/bin/bash", "-c"]
# Curl command from https://unix.stackexchange.com/a/421318/14436
RUN echo -e 'function __curl() { \n read proto server path <<<$(echo ${1//// }) \n DOC=/${path// //} \n HOST=${server//:*} \n PORT=${server//*:} \n [[ x"${HOST}" == x"${PORT}" ]] && PORT=80 \n exec 3<>/dev/tcp/${HOST}/$PORT \n echo -en "GET ${DOC} HTTP/1.0\\r\\nHost: ${HOST}\\r\\n\\r\\n" >&3 \n (while read line; do \n [[ "$line" == $'"'"'\\r'"'"' ]] && break \n done && cat) <&3 \n exec 3>&- \n}' > curl.sh
# TODO: use __curl to get wget or curl or something better for better output if one of the below downloads fails ...
RUN source curl.sh && \
__curl http://launchpadlibrarian.net/389235809/liblcms1_1.19.dfsg-1ubuntu3.1_amd64.deb > liblcms1_1.19.dfsg-1ubuntu3.1_amd64.deb && \
__curl http://launchpadlibrarian.net/83092708/libmng1_1.0.10-3_amd64.deb > libmng1_1.0.10-3_amd64.deb && \
__curl http://launchpadlibrarian.net/377985985/libpng12-0_1.2.46-3ubuntu4.3_amd64.deb > libpng12-0_1.2.46-3ubuntu4.3_amd64.deb && \
__curl http://launchpadlibrarian.net/86479683/libqt3-mt_3.3.8-b-8ubuntu3_amd64.deb > libqt3-mt_3.3.8-b-8ubuntu3_amd64.deb && \
__curl http://launchpadlibrarian.net/58578046/pdfedit_0.4.5-2_amd64.deb > pdfedit_0.4.5-2_amd64.deb && \
__curl http://launchpadlibrarian.net/279293539/fontconfig_2.8.0-3ubuntu9.2_amd64.deb > fontconfig_2.8.0-3ubuntu9.2_amd64.deb && \
__curl http://launchpadlibrarian.net/149258100/libaudio2_1.9.3-4ubuntu0.1_amd64.deb > libaudio2_1.9.3-4ubuntu0.1_amd64.deb && \
__curl http://launchpadlibrarian.net/279293538/libfontconfig1_2.8.0-3ubuntu9.2_amd64.deb > libfontconfig1_2.8.0-3ubuntu9.2_amd64.deb && \
__curl http://launchpadlibrarian.net/440576614/libfreetype6_2.4.8-1ubuntu2.7_amd64.deb > libfreetype6_2.4.8-1ubuntu2.7_amd64.deb && \
__curl http://launchpadlibrarian.net/94947351/libice6_1.0.7-2build1_amd64.deb > libice6_1.0.7-2build1_amd64.deb && \
__curl http://launchpadlibrarian.net/94579504/libjpeg8_8c-2ubuntu7_amd64.deb > libjpeg8_8c-2ubuntu7_amd64.deb && \
__curl http://launchpadlibrarian.net/94947900/libsm6_1.2.0-2build1_amd64.deb > libsm6_1.2.0-2build1_amd64.deb && \
__curl http://launchpadlibrarian.net/496048808/libx11-6_1.4.99.1-0ubuntu2.5_amd64.deb > libx11-6_1.4.99.1-0ubuntu2.5_amd64.deb && \
__curl http://launchpadlibrarian.net/140925309/libxcursor1_1.1.12-1ubuntu0.1_amd64.deb > libxcursor1_1.1.12-1ubuntu0.1_amd64.deb && \
__curl http://launchpadlibrarian.net/203090918/libxext6_1.3.0-3ubuntu0.2_amd64.deb > libxext6_1.3.0-3ubuntu0.2_amd64.deb && \
__curl http://launchpadlibrarian.net/94948951/libxft2_2.2.0-3ubuntu2_amd64.deb > libxft2_2.2.0-3ubuntu2_amd64.deb && \
__curl http://launchpadlibrarian.net/203091986/libxi6_1.7.1.901-1ubuntu1~precise3_amd64.deb > libxi6_1.7.1.901-1ubuntu1~precise3_amd64.deb && \
__curl http://launchpadlibrarian.net/140930018/libxinerama1_1.1.1-3ubuntu0.1_amd64.deb > libxinerama1_1.1.1-3ubuntu0.1_amd64.deb && \
__curl http://launchpadlibrarian.net/203094691/libxrandr2_1.3.2-2ubuntu0.3_amd64.deb > libxrandr2_1.3.2-2ubuntu0.3_amd64.deb && \
__curl http://launchpadlibrarian.net/202510483/libxrender1_0.9.6-2ubuntu0.2_amd64.deb > libxrender1_0.9.6-2ubuntu0.2_amd64.deb && \
__curl http://launchpadlibrarian.net/279293542/fontconfig-config_2.8.0-3ubuntu9.2_all.deb > fontconfig-config_2.8.0-3ubuntu9.2_all.deb && \
__curl http://launchpadlibrarian.net/442009060/libexpat1_2.0.1-7.2ubuntu1.7_amd64.deb > libexpat1_2.0.1-7.2ubuntu1.7_amd64.deb && \
__curl http://launchpadlibrarian.net/483376388/libjpeg-turbo8_1.1.90+svn733-0ubuntu4.6_amd64.deb > libjpeg-turbo8_1.1.90+svn733-0ubuntu4.6_amd64.deb && \
__curl http://launchpadlibrarian.net/496048599/libx11-data_1.4.99.1-0ubuntu2.5_all.deb > libx11-data_1.4.99.1-0ubuntu2.5_all.deb && \
__curl http://launchpadlibrarian.net/84788368/libxau6_1.0.6-4_amd64.deb > libxau6_1.0.6-4_amd64.deb && \
__curl http://launchpadlibrarian.net/140864111/libxcb1_1.8.1-1ubuntu0.2_amd64.deb > libxcb1_1.8.1-1ubuntu0.2_amd64.deb && \
__curl http://launchpadlibrarian.net/203092202/libxfixes3_5.0-4ubuntu4.4_amd64.deb > libxfixes3_5.0-4ubuntu4.4_amd64.deb && \
__curl http://launchpadlibrarian.net/141012031/libxt6_1.1.1-2ubuntu0.1_amd64.deb > libxt6_1.1.1-2ubuntu0.1_amd64.deb && \
__curl http://launchpadlibrarian.net/127495438/x11-common_7.6+12ubuntu2_all.deb > x11-common_7.6+12ubuntu2_all.deb && \
__curl http://launchpadlibrarian.net/70775788/gsfonts-x11_0.22_all.deb > gsfonts-x11_0.22_all.deb && \
__curl http://launchpadlibrarian.net/84805563/libxdmcp6_1.1.0-4_amd64.deb > libxdmcp6_1.1.0-4_amd64.deb && \
__curl http://launchpadlibrarian.net/52149269/ttf-bitstream-vera_1.10-8_all.deb > ttf-bitstream-vera_1.10-8_all.deb && \
__curl http://launchpadlibrarian.net/100987553/ttf-dejavu-core_2.33-2ubuntu1_all.deb > ttf-dejavu-core_2.33-2ubuntu1_all.deb && \
__curl http://launchpadlibrarian.net/70804192/ttf-freefont_20100919-1_all.deb > ttf-freefont_20100919-1_all.deb && \
__curl http://launchpadlibrarian.net/71073801/ucf_3.0025+nmu2ubuntu1_all.deb > ucf_3.0025+nmu2ubuntu1_all.deb && \
__curl http://launchpadlibrarian.net/56199369/gsfonts_8.11+urwcyr1.0.7~pre44-4.2ubuntu1_all.deb > gsfonts_8.11+urwcyr1.0.7~pre44-4.2ubuntu1_all.deb && \
__curl http://launchpadlibrarian.net/74357981/xfonts-utils_7.6+1_amd64.deb > xfonts-utils_7.6+1_amd64.deb && \
__curl http://launchpadlibrarian.net/59359929/libfontenc1_1.1.0-1_amd64.deb > libfontenc1_1.1.0-1_amd64.deb && \
__curl http://launchpadlibrarian.net/200541371/libxfont1_1.4.4-1ubuntu0.3_amd64.deb > libxfont1_1.4.4-1ubuntu0.3_amd64.deb && \
__curl http://launchpadlibrarian.net/97312039/xfonts-encodings_1.0.4-1ubuntu1_all.deb > xfonts-encodings_1.0.4-1ubuntu1_all.deb
RUN dpkg -i *.deb && \
rm -rf *.deb curl.sh
CMD pdfedit
⚠ These steps no longer work. The links are broken (see above for working links), but the bigger issue is that the packages are too old to work in a modern version of Ubuntu.
sudo -v
# Setup
mkdir tmp
cd tmp
# Install PDFEdit and dependencies
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lcms/liblcms1_1.19.dfsg-1ubuntu3_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/libm/libmng/libmng1_1.0.10-3_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/q/qt-x11-free/libqt3-mt_3.3.8-b-8ubuntu3_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/pdfedit/pdfedit_0.4.5-2_amd64.deb
sudo dpkg -i *.deb
# Cleanup
rm *.deb
cd ..
rmdir tmp
# To uninstall:
# sudo apt autoremove liblcms1 libmng1 libpng12-0 libqt3-mt pdfedit
Yeah, so I created the temp folder for easier installation (
dpkg -i *.deb
) and cleanup (rm *.deb
). Otherwise you'd have to install and remove each package individually to make sure you don't accidentally delete any other .deb files in the folder where you run the script. It's also nice to have everything in one folder so if the script aborts you can clean up without having to sift through other files in the working directory.So to answer your question it's not necessary, it just makes things a little easier.