Skip to content

Instantly share code, notes, and snippets.

@mark-cooper
Created November 4, 2014 17:12
Show Gist options
  • Save mark-cooper/1fa3a8d98d398c1ddbdd to your computer and use it in GitHub Desktop.
Save mark-cooper/1fa3a8d98d398c1ddbdd to your computer and use it in GitHub Desktop.
ArchivesSpace EAD XML to PDF

ArchivesSpace EAD XML to PDF

These instructions describe how to do this locally. There are two motivating reasons:

  1. ArchivesSpace Rack time out errors when attempting to export pdf.
  2. Batch pdf processing (assuming batch EAD export not covered here).

Pre-reqs

  1. Create and enter a working directory (i.e. mkdir ead_to_pdf).
  2. Create the file as-ead-pdf.xsl and copy and paste the contents of this file into it.
  3. Create the file as-helper-functions.xsl and copy and paste the contents of this file into it.
  4. Create an ead directory.
  5. Download Saxon, unzip to working directory and rename to saxon.jar.
  6. Download Fop.
  7. Add the fop directory to $PATH (you should be able to fop -v).

Converting a file

Place EAD XML files in the ead directory.

# run saxon on ead files
for file in ead/*.xml ; do java -jar saxon.jar ${file} ./as-ead-pdf.xsl -o:${file/%.xml/.fo} ; done

# run fop on .fo output files
for file in ead/*.fo ; do fop -fo ${file} -pdf ${file/%.fo/.pdf}; done

@trevorthornton
Copy link

Hi Mark-

Just discovered this in trying to diagnose the problem of EAD/PDF exports timing out. I'm assuming that the fact that you did this means that there is no real fix for the underlying problem (the Rack timeout). Is that a safe assumption?

Anyway, thanks for this either way.

-Trevor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment