-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyPDF2 in place of pdftk #21
Comments
Also pdfrw (https://github.com/pmaupin/pdfrw) is a pure-python implementation but I have never used it |
I like the idea. 👍 |
Yes! That's better~ |
I suspect you have all moved on, as this project hasn't been touched in a year, but pdftk has been removed from deb & ubuntu due to upstream dependencies (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892539) so changing this dependency would be awesome :-) |
Another option is use latex with the pdfstack "${tmpfolder}"/background.pdf "${tmpfolder}"/foreground.pdf "${filename}.pdf" in place of Line 354 in a0a9d82
(NOT tested much) #!/bin/zsh
latex='xelatex'
bgf=$1
fgf=$2
out=$3
base=${out:r}
tmpdir=`mktemp -d`
fbase="${tmpdir}/${base}"
fbdir=${fbase:h}
/bin/mkdir -pv $fbdir
/bin/cp $bgf $fgf $fbdir
cat <<EOF > "${fbase}.tex"
\\documentclass{article}
\\usepackage{graphicx}
\\usepackage{pdfpages}
\\begin{document}
\\makeatletter
\\includepdf[pages=-,picturecommand={
\\includegraphics[page=\\AM@page]{${bgf:t}}
}]{${fgf:t}}
\\makeatother
\end{document}
EOF
cd $fbdir
${latex} $fbase
cd -
cp "${fbase}.pdf" "${base}.pdf" |
My suggestion here was to reduce the need for external dependencies, but your script is quite neat and also more portable than the original |
We should probably collect all these solutions somewhere since in this repo looks like there is not much of a chance to make changes |
Sure. For me latex and pdfpages are basic tools, so this indeed saved me a lot of dependencies (all the java stuff around pdftk), but of course it depends on the setup |
By the way, it seems that the list of dependencies in the README is completely off... |
We could reduce the dependencies of the package by moving to PyPDF2 (https://github.com/mstamy2/PyPDF2). In this way we could have a fully pythonic implementation of the tools that is easier to make corss-platform.
If you think this could be interesting, I am going to investigate it as soon as I have some time
The text was updated successfully, but these errors were encountered: