A scipt to convert Striata statements to PDF
it's a bit of a hack, but maybe someone else can use it too
Not too long ago, I signed up for a contract with Cell C. I like to keep records digitally, so when I got to choose between having statements delivered by email or post, I chose email.
When the first email arrived, I was disappointed to find out that they were using something called “Striata Reader”. When I reached out to Cell C over Twitter asking why they’ve chosen this format over one in more widespread use, like PDF, I was told it was for security reasons. Striata’s statements are in an encrypted format, but since there isn’t a key needed I’m not sure what security this is actually supposed to provide.
Regardless, for my own records, I don’t want to try keeping statements in Striata format. I’d much rather keep it in a format that can be opened by open source applications. So the challenge is how do I take these Striata statements, and convert them to PDF?
After a bit of digging, it turns out that Striata format is just HTML wrapped in some sort of archive. If you go for the Linux version of Striata reader here, it has a command line version of the reader, which helps at least. I’m not sure how to script this if you’re on a Windows box at the moment. After extracting the HTML, I stick it all into one file and use wkhtmltopdf to make it a pdf.
I named the script on my machine
emc-to-pdf because Striata’s file
extension is .emc.
This script is a bit of a hack that I threw together after a Twitter
argument with customer support about file formats. You may need to
modify it to suit your environment. It assumes it can do whatever it
/tmp/striata-statement/. You have been warned.
#!/bin/bash # # Usage: emc-to-pdf <source> <destination> # # Converts .emc statement in argument one to a pdf with # # Source: The .emc file you want to convert # Destination: The pdf file you want to create # WARNING: Assumes /tmp/striata-statement/ does not exist yet mkdir /tmp/striata-statement striata-readerc -outdir="/tmp/striata-statement/" $1 cat /tmp/striata-statement/*.html > /tmp/striata-statement/concat.html wkhtmltopdf /tmp/striata-statement/concat.html $2 rm -r /tmp/striata-statement
Suggestions on how to improve this script are welcome in the comments below.