Package: pdfebc
DocsContentsOverviewPurpose of the projectRequirementsInstallOption 1: Install from PyPi withpipOption 2: Clone the repo and the install withpipLicenseContributingTODOOverviewpdfebcis a CLI tool that usesGhostscriptto compress PDF documents to a size that befits
an ebook reader, such as a Kindle. The CLI works by targeting a source and output directory (if
not specified by the user, defults to use.for source andpdfebc_outfor output), and then
compresses all PDF files in the source directory and puts the results in the output directory.
There is also functionality for sending the compressed documents to a pre-configured e-mail
address using Google’s SMTP server (which can easily be swapped for any SMTP server by editing
the source code, seeRequirementsbelow). Files that are less than 1 MB in size are not
compressed, as I have found that compressing such small files often leads to them increasing
in size several times over instead (I have yet to figure out why). Do note thatGhostscriptis fairly slow, so expect large files to take a while to compress.As an example use case, I mainly usepdfebcas an easy way to compress lecture slides and
similar study materials, send them to my Kindle and then clean up the output.Purpose of the projectThe core functionality ofpdfebcwas already done when I started this little project. As
such, the main purpose here isn’t to provide the functionality, but to do so in a robust way,
with proper documentation, testing and continuous integration. It is, essentially, my first
foray into using stuff likesphinx,Travis-CIandReadTheDocs, so there’s bound to be
some weirdness here and there. I am also diving deeper into how to usegitand trying new
things, so the commit history is a bit inconsistent.RequirementsPython 3.6Strictly speaking, 3.5 should also work fine, but the tests use 3.6 features so the
build is only tested for 3.6.GhostscriptpdfebcrequiresGhostscriptfor the PDF compression. The default binary isgs,
but this can be specified via the CLI.A Gmail account (for sending e-mails)By default,pdfebcuses Google’s SMTP server to send e-mails. If you don’t intend
to use the send functionality, then you may disregard this requirement.It is possible to use a different SMTP server by changing theSMTP_SERVERvariable in thepdfebc.utilsmodule. Note that TLS is enabled and will likely cause sending e-mails
using a local server that does not have TLS impossible.InstallOption 1: Install from PyPi withpipThe latest release ofpdfebcis on PyPi, and can thus be installed as usual withpip.
I strongly discourage globalpipinstalls (i.e.sudo pip install <package>), as this
may land you with incompatible packages in a very short amount of time. A per-user install
can be done like this:Executepip install--userpdfebcto install the package.Typeecho "$PATH"and verify that$HOME/.local/binis on thePATH.If it is not, add it by addingexportPATH="$PATH:$HOME/.local/binto your shell configuration
file (e.g.$HOME/.bashrcforbash).Then executesource <path_to_config_file>Currently, you must add the configuration file manually. Please have a look at thesample configurationfile for details. To find out where to place the file, runpdfebc-h. This should cause a message to appear, telling you where to put the file.
This lazy way of handling the setup of the configuration will be replaced with a step-by-step
config creator in version0.3.0.Note:When using a Gmail account, I strongly recommend
using anApp passwordinstead of the actual account password.Verify the installation by executingpdfebc-h. You should see usage information printed to stdout,
with no errors.Option 2: Clone the repo and the install withpipIf you want the dev version, you will need to clone the repo, as only release versions are uploaded
to PyPi. Unless you are planning to work on this yourself, I suggest going with the release version.Clone the repo withgit:git clonehttps://github.com/slarse/pdfebccdinto the project root directory and install withpip.pip install--user., global installs are not recommended.Or justpip install .if you usevirtualenv.For development, usepip install-e.in avirtualenv.Currently, you must add the configuration file manually. Please have a look at thesample configurationfile for details. To find out where to place the file, runpdfebc-h. This should cause a message to appear, telling you where to put the file.
This lazy way of handling the setup of the configuration will be replaced with a step-by-step
config creator in version0.3.0.Note:When using a Gmail account, I strongly recommend
using anApp passwordinstead of the actual account password.Verify the installation by executingpdfebc-h. You should see usage information printed to stdout,
with no errors.LicenseThis software is licensed under the MIT License. See thelicense filefile for specifics.ContributingI am currently not looking for contributions. At this point, this is a practice project for me,
and even if I were looking for outside help the test suite is nowhere near comprehensive enough
for that yet. Sorry!TODOImprove code coverage.Add more negative tests.