Docs | Attachment Converter

Table of Contents

Guide Docs API github.svg navbar.svg

1. Installation

Once this software is ready for official release, we will be providing multiple installation options across as many hardware and OS platforms as we can. Currently, however, the only way to install the project is to build it from source, which you probably only realistically want to attempt if you're either a developer or a system administrator. These instructions are currently undergoing heavy revision, so if you try them out and experience any difficulties, please don't hesitate to contact us. User feedback at this stage is incredibly valuable.

For ordinary users, we intend to make Attachment Converter available to install via one of the standard package managers and also directly as a binary upon its first release. Please check back later this year for updates!

As we work toward our first release, here are instructions for building Attachment Converter from source and then installing it.

We have two available installation methods: an automated process using a GNUmakefile and a manual process. Either method will require you to download the source code.

You can get the latest source straight from our GitHub repository:

$ cd /path/to/your/source/code
$ git clone https://github.com/uchicago-library/attachment-converter.git

1.1. Automated Installation

Once you have finished downloading the source code, run:

$ make home-install

At the end of the installation process, you will see a notice saying:

Attachment Converter has been installed to ~/bin/attc.
Please ensure that ~/bin is on your path.

You can ensure that the installation worked as intended by the following command.

MacOS:

$ echo "export PATH=~/bin:$PATH" >> ~/.zshrc

WSL Debian & Arch Linux:

$ echo "export PATH=~/bin:$PATH" >> ~/.bashrc

1.2. Manual Building

1.2.1. Install opam

Attachment Converter is written in OCaml, which means that in order to build it, you need to install the opam package manager, which we recommend doing via your operating system's package manager. For example:

Arch Linux:

$ pacman -S opam

macOS:

$ brew install opam

WSL Debian:

$ apt install opam

Then, regardless of how you install opam, you need to initialize it in order to be able to use it.

$ opam init
$ eval $(opam env)

opam should then print some information to the console telling you about the steps it's taking to initialize.

That should be enough to get you going, but if you'd like more detailed information on how to install opam, please see the official installation instructions.

1.2.2. Install Mercurial

Attachment Converter relies on the Mercurial version control system to install some of its third-party library dependencies. For example:

Arch Linux:

$ pacman -S mercurial

macOS:

$ brew install mercurial

WSL Debian:

$ apt install mercurial

1.2.3. Install opam dependencies

To install all third-party library dependencies for Attachment Converter to your ~/.opam directory (which is where opam put the OCaml compiler and other packages it's going to use when you ran opam init), please run the following make rule from the root directory of the GitHub project you cloned:

$ cd /path/to/your/source/code/attachment-converter
$ make deps

This will make the Digital Library Development Center's very own opam repository available to you, then install all of Attachment Converter's third-party library dependencies. make deps should suffice for most purposes, but if you'd like to pursue the slightly fancier option of creating a sandboxed opam switch, you can instead run:

$ cd /path/to/your/source/code/attachment-converter
$ make sandbox

If you don't know what a sandboxed opam switch is, we suggest not worrying about it and going with the make deps rule.

1.2.4. Install OS-level dependencies

Next, you must install Attachment Converter's OS-level dependencies. For example:

Arch Linux:

$ pacman -S libreoffice pandoc libvips ghostscript

macOS:

$ brew install libreoffice pandoc vips ghostscript verapdf

WSL Debian:

$ apt install libreoffice pandoc vips ghostscript verapdf

Finally, Attachment Converter has one OS-level dependency that is not available through the standard repositories, called pdf2archive. This is a utility for converting PDF to PDF-A-1b.

Download pdf2archive:

$ cd /path/to/your/source/code
$ git clone git@github.com:matteosecli/pdf2archive.git
$ cd pdf2archive
$ chmod +x ./pdf2archive
$ export PATH=$PATH:/path/to/your/source/code/pdf2archive

1.2.5. Copy shell scripts to standard location

In our current pre-alpha stage, the shell scripts that Attachment Converter uses to invoke external conversion utilities are expected to be located at a specific filepath. This is expected to change soon as we flesh out our installation story. For this next step, please copy them to that location:

$ cd /path/to/your/source/code/attachment-converter
$ mkdir -p ~/.config/attachment-converter/scripts
$ cp conversion-scripts/*.sh ~/.config/attachment-converter/scripts

1.2.6. Time to Build

You should now be ready to build Attachment Converter. To build:

$ cd /path/to/your/source/code/attachment-converter
$ make

You can then install Attachment Converter by copying the binary to wherever you keep your binaries:

$ cd /path/to/your/source/code/attachment-converter
$ mv _build/default/main.exe /path/to/your/binaries/attc

2. Advanced Concepts

2.1. Conversion Customization

Coming soon…

back_to_top.svg

Author: Matt Teichman

Created: 2023-08-24 Thu 16:09

Validate