Wednesday, December 16, 2009

Filling in PDF forms using Open Office - Mail Merge Style

We recently changed an HR related supplier at work. As a result, every employee (100+) had to fill in a three page form. The new supplier provided us a non-editable PDF.

As anyone working in a mid-sized company knows, getting 100 people to do the same thing correctly is pretty much an exercise in futility :-)

Now 98% of that form HR knew the answers too - name, address, date of first employment etc. etc. Open Office can do a 'mail merge' from the spreadsheet with that data in it to a document in Writer, but can't import PDF natively.

My first thought was to use the pdf import extension for Open Office. It works ok, but imports the PDF as a Draw document, rather than a Writer document. Draw documents don't do mail merges as far as I can see.

My second thought was to create a Writer document, and use the form as the page background. Turns out setting a page background with an image works ok, but the same image is repeated on every page. Won't work for our multipage document unless we created three documents and somebody played manual collator for a while. Sure as heck something would get scrambled.

What I did in the end was time consuming but worked well.

  1. Convert each page of the pdf form into a tiff or similar high quality image file
  2. Register your spreadsheet or database as a data source.
  3. Start with a new Write document. Hit return enough times to create number of pages you need.
  4. Choose Insert -> Frame.

    1. Make sure it's anchored to the page
    2. Positioned for the entire page
    3. Name it on the Options Tab (optional, but handy)
    4. Set borders to none on the Borders tab
    5. On the Background tab change it to Graphic instead of Color, and browse for your first page image.
    6. Move the image around until it covers the entire page properly
    7. Right click and choose Alignment -> Back
    8. Hit OK
    9. Repeat for each page

  5. Choose View -> Data Sources and highlight your data source so the fields you want are displayed at the top of your window.
  6. Choose Insert -> Frame.

    1. Make sure it's anchored to the page
    2. Make sure auto size is off
    3. Name it on the Options Tab (optional, but handy)
    4. Set borders to none on the Borders tab
    5. Hit OK

  7. Now drag the Heading from the first column of data into that frame
  8. Move the frame to the right spot on the background to fill in the blank
  9. Lather, rinse repeat for each piece of data on each page

When you choose 'Print' it will ask you if you want the blanks filled in, and away you go!

I haven't posted any screenshots - Let me know if you think you need them and I can create some.

Hope this helps somebody!

Tuesday, December 1, 2009

Installing a Samsung SCX-4521F in Linux - Ubuntu Hardy Heron actually

I've seen a lot of comments across the web about this particular printer and getting it and the scanning working in Ubuntu.

It was easy for me - here's my simple checklist
Note I'm using a USB interface.

  1. Get the Samsung Unified Driver version 3
  2. Install it via tar xvzf SamsungXXX.tar.gz && cd cdroot/Linux && sudo ./ I did it without using X at all, I gather there's a little GUI that doesn't ask anything text install doesn't.
  3. Curse Samsung for putting the freaking icon on your desktop and the root of your applications menu without asking
  4. Clean up the crap you just cursed about.UPDATE forgot to mention the specifics - /bin/Desktop /bin/.gnome-desktop /usr/sbin/Desktop /usr/sbin/.gnome-desktop Yes, that install script has some bugs in it!
  5. Try a test page. Samsung 'helpfully' decided to make the new printer the default, so lpr favourite.pdf should work fine.
  6. Try scanimage -L and see if you can see the printer. If not (bet you can't) try sudo scanimage -L. If that works, it's a permissions problem.
  7. Add all the appropriate users to the lp group. e.g. sudo addgroup joeUser lp. The installer says it's doing something like this, but whatever it does doesn't work. Ubuntu has the handy scanner group as well, but the lp group ends up owning /dev/usb/0. Rather than muck about with updated udev rules, I just added the users to both the scanner and lp groups and it works fine.
  8. Log out of that terminal session and start a new one. A terminal doesn't pick up updated group membership until it logs in the next time. Dunno whether that applies to the 'GUI' users and group tool or not. Let me know....
  9. Use scanimage -L to see if sane can see the scanner.