Archive

Archive for February, 2013

JLSN – Creating an Editable PDF file

February 27, 2013 Leave a comment

Problem:
I needed to create a pdf file that allows one to fill in some details, save the changes and email the changed file.

Solution:

After searching on google, I found the following instructions that worked perfectly for me.

OpenOffice.org 2 Writer – how to create a PDF form you can fill in
1. Open a new blank writer document.
2. Type a phrase to use as a label (Example: Last name)
3. View > Toolbars > Form Controls (Checked)
4. Move the cursor over the Form Control Toolbar until the tooltip shows Text Box. Click the icon.
5. Drag the cursor over the location where you want to insert the text box.
If necessary, resize it using the handles or move it while the cursor shows a plus shape.
(Optional): Right-click the text box and change options – name, submission type etc….
6. Repeat for all the fields to enter.

If you want a default value for some or all of the fields, Click the Design Mode On/Off icon on the Form Control Toolbar to toggle off the design mode, then fill in the default values for the appropriate field(s).
7. File > Save As PDF
Save it.
Open PDF document using Adobe Acrobat.

I did this on Debian Squeeze and I can fill in the pdf when using Document Viewer, xpdf and ePDFViewer do not seem to be able to allow that to work. So it works well with Document Viewer, but fails on Windows with Adobe Acrobat 9.

Looks like it is a known issue https://issues.apache.org/ooo/show_bug.cgi?id=121782 Now my problem is that 100% of the users this was intended for are on Windows and are going to use Adobe Acrobat. I guess I am going to have to use a word document after all.

After more searching
https://blogs.adobe.com/dmcmahon/2011/09/10/adobe-reader-fill-out-a-pdf-form-or-type-text-on-a-pdf-file-using-adobe-reader/

Source:
http://www.oooforum.org/forum/viewtopic.phtml?t=43073

Advertisements

sorttable – Make all your tables sortable

February 27, 2013 Leave a comment

Library that helps you have tables on you web page that can be sorted by column.

http://www.kryogenix.org/code/browser/sorttable/

Quick Note – convert 1 to 4 as 1,2,3,4

February 5, 2013 3 comments

With GNU bash version 4.1.5

$seq 1 4 | tr '\n' ',' | sed 's/,$/\n/'
1,2,3,4

With awk (mawk version 1.3.3)

$seq 1 4 | awk -f transpose.awk | sed 's/^,//'
1,2,3,4

What transpose.awk looks like.

#!/usr/bin/awk
{
    for(i=1;i<=NF;i++)
      _[i]=sprintf("%s,%s",_[i],$i)
}
END{
    for(i in _)
        print _[i] 
} 

Source:
http://www.unix.com/shell-programming-scripting/193989-transpose-whole-file-specific-columns.html

Categories: awk, bash

mdb – Getting data from Microsoft Access *.mdb files

February 1, 2013 Leave a comment

Problem:

I had to get data from a Microsoft Access database but I do not have MS Windows installed.

Solution:
What worked for me was mdb-export and mdb-tables which are both part of the mdbtools suite in linux.

I wrote a script to extract all the data.

#!/bin/bash

WDIR="/home/user/dumps"
DATABASE="database.mdb"
_date="$(date +'%F')"

cd $WDIR/

# Get the tables.
mdb-tables $DATABASE | tr ' ' '\n' > db-tables.csv

sed '/^$/d' db-tables.csv | \
while read table
do
    echo $table
    mdb-export $DATABASE $table > dumped_${table}_${_date}.csv
done 

# Clean up
rm db-tables.csv

Source:
http://mazamascience.com/WorkingWithData/?p=168