Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Looking for a program or a way to print onto my bank checks in Ubuntu. I don't want to use GNUCash or KMyMoney as those are bank register program's and it's too much work to open one of those each and every time to print out a simple check. I keep registry else ware so I don't need them to also.

Lazarus doesn't have a good Reporting tool, I have tried FortesReports for Lazarus and it's very very very buggy, won't print landscape and won't change paper size. It's just a mess. So I can't make an application myself. I thought about going into XP and with Delphi making the app, a lot of Delphi 7 apps run in Wine.

But if I can help it I would like to stick to Linux native somehow.

So does anyone know of a way or script to print checks? I tried the Ruby script for it but I cannot find anyway to download it anymore, all links are dead. Same with python check printing app I found for linux.

I made a Bash script for it, but it's not perfect and I can't really control field margins and spacing.

Bash script:

#!/bin/sh

day=$(zenity --entry --text "Day of Month");
month=$(zenity --entry --text "Month");
amount=$(zenity --entry --text "Amount for Check");
to=$(zenity --entry --text "The check is made out to");
letters=$(zenity --entry --text "Amount in Letters");

rm -f prcheck
echo "



     Guatemala $day de $month del 2,012       $amount
     $to

   $letters" > prcheck

lp -o media=2.5x6.5 -o landscape -o page-top=-0.5 prcheck

Like I said this works fine, problem is the spacing is not 100% perfect, and as the date goes changing so does the amount based on the text width of the month.

I read somewhere that Latex might be able to do it, but I know absolutely NOTHING about latex or how to use it. I would like something that I can just enter the fields and then it prints. Even if I have to use a bash script to get the fields and send it to a CLI program like I'm doing now.

share|improve this question
    
A partial solution would be to modify your current script to use printf or sprintf, which can format strings such as dates much more precisely. Read their respective man pages for details. –  Scott Severance Sep 7 '12 at 2:28
    
LaTeX would be a great tool for this problem, but has quite a learning curve for such a simple task. –  Phoenix Stormcrow Sep 12 '12 at 3:46

1 Answer 1

up vote 2 down vote accepted

After a lot of searching and work it just doesn't exist. So I ended up going with Latex, come to find out for simple table printing it's not as hard as it looked. It was just a matter of learning to use margin's and how to set page sizes.

To create the latex file and for testing I used Texmaker, just seemed to be the easiest with features.

The biggest part was getting latex to margin thing's out, through help on another stack site I got the kinks out and ended up using a bash script to print the final PDF and set page size and landscape. I tried originally setting these two thing's in the latex file, but it just wouldn't work. But once I set it at the CLI to landscape and the check size it worked like a charm.

So Latex it is, seem's to be the easiest and fastest way once you know. It was so easy and fast that once I had one of my check's setup I went and copied it and setup my second bank's check's. The second time it only took me about 10 Min. to re-layout the new Tex file for the new check's.

The latex format I used was:

\documentclass[12pt]{article}

\usepackage[paperwidth=6in,paperheight=2.75in,margin=0.60in]{geometry}

\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{wallpaper}
%\CenterWallPaper{1}{check53.png}

\pagestyle{empty}

\setlength{\parindent}{0pt}

\begin{document}

\begin{tabular}{ @{} p{4.05in} l @{} }
\multicolumn{2}{ l }{\hspace{3in}\textbf{#date}} \\ 
\rule{0pt}{0.30in}\hspace{0.30in}\textbf{#to} & \textbf{#amount} \\
\multicolumn{2}{ l }{\rule{-0.20in}{0.25in}\textbf{#letters}} \\
\end{tabular} 

\end{document}

As you'll notice I have variables to replace for instance #date is the variable I replace the date with, and so forth with the other's. This allow's SED from the commandline to find them and replace real quick.

I also have wallpaper in my tex file, this is so that when testing I don't have to print out a bunch on paper and test. I can scan in my check and place it as background to the latex file, export to PDF for testing. This comes within CM's of where I needed the final at. So all in all a good way for testing.

Then the bash file was pretty straight forward, thanks to Zenity, SED and LP.

#!/bin/sh

date=$(zenity --entry --text "Date");
amount=$(zenity --entry --text "Amount for Check");
to=$(zenity --entry --text "The check is made out to");
letters=$(zenity --entry --text "Amount in Letters");

rm -f check532.pdf
cp check53.tex check532.tex
sed -i "s,#date,$date," check532.tex
sed -i "s/#amount/$amount/" check532.tex
sed -i "s/#to/$to/" check532.tex
sed -i "s,#letters,$letters," check532.tex

pdflatex check532.tex

#echo "Please put your check in the printer, right side down."
#read -p "Press any key to print... " -n1 -s
zenity --info --text "Please put your check in the printer, right side down. Then click OK to print."

lp -o media=2.75x6 -o landscape check532.pdf
rm -f check532.log check532.pdf check532.aux check532.tex

First off I use Zenity to get the parameters needed for the check; To, amount, date and the text version of amount.

Then I let SED to a search and replace after making a new copy of the file for the search and replace. Once done I export to PDF and then print using LP commandline.

All in all it's pretty cool since I now have an icon in my Gnome bar and click it, it ask's for params then tells me to insert paper, then print's!

So it was a pain learning Latex, but I have to say until some software comes out for it this seem's to be the quickest and easiest way. Plus software might be a bit more cumbersome than just doing it this way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.