Monday 11 April 2011

Konica Minolta Bizhub C652, C652DS, C650 driver with Account Tracking for CUPS

We recently got a new printer on the 6th floor of the EN buiding where our Faculty and Research Group resides. It's a Konica Minolta Bizhub C652DS, the slightly newer model of the C650 found on the 5th floor.

Quite a massive printer, with additions like folding, stapling and hole punching units etc.
The CUPS drivers from Konica are actually not too bad, with the exception that they do not support account tracking, which is used within the faculty.

With the help of John and Jason and some searching I was able to create two PPD files for the C652 and C650 printers, using the femperonpsc250mu.pl filter by Rui Ferrera.

It's now as simple as copying the femperonpsc250mu.pl script to the cups filter directory (like /usr/libexec/cups/filter) and setting the right owner and permissions, and then installing the printer using the new C652 and C650 PPD files found here, using the lpd:// protocol.
(It might also work via https:// as described here)

As CUPS does not yet allow to create an input field for options, you need to set the account key etc. by pull down menu (or combobox or whatever you call them).

It also works if you install the printer on a single CUPS printserver, and just point the various clients to it. In that case anyhow you'll need to set your own passcode or account key in each printing UI (like once for KDE apps once for GTK apps)

Happy printing!

Download the tarball

Tuesday 5 April 2011

Issues with PC-BSD 8.2

Coming back to work from my break, it was about time to get rid of FreeBSD 9.0 CURRENT on my production machine and to install a more stable system. As Grenville had almost only good things to say about PC-BSD (like a super easy ZFS installation), I gave it a shot.

I have to say: the installation process is really nice, not like FreeBSD. Took only a few clicks and a bit of waiting, and it worked. Installing additional programs was easy through the PBI system - for the software available. to get more, I had to use the ports system as usual. No problem at all, no conflicts (except that PC-BSD ships with howl, but I prefer avahi).

It's not all good and shiny though.Upon firing up VirtualBox for example, it fired up kdesu and asked me to login as root to continue. Well - done that, thought not much about it, must be PC-BSD's way. Same thing then for Skype, and things started not to make much sense, specially as Skype just wouldn't start that way. Upon firing up Wireshark it wanted to run it as root again. Well that's a no-no, except you really intend to, which most of the time I do not. It also comes up with a big fat warning if you do that.

I don't know why PC-BSd sets the programs up to start like that from KMenu or the KLauncher (ALT+F2), but it doesn't make sense. so to get rid of that behaviour, just right klick on the KMenu -> Menu editor , select the program in question, go to the Advanced tab and deselect the "run as different user" checkbox.


Now, the next thing to fix is Kile which complains about Okular not being installed although it is and getting KDE programs to find the printers, which GTK programs already do.

Monday 4 April 2011

Embedding fonts in PDFs using ghostscript without recompiling or reexporting the source text

Well, this has been tackled many times already in a variety of blogs and webpages, but I keep it here as reference.

There is always some crappy program that doesn't embed the fonts when exporting to PDF -- which is needed for some conference papers.

In my case the crappy tool is Matlab. Instead of going back and fiddling around with Matlab to export the graphs again and try to get it to embed fonts, I prefer the following shortcut found here.

Actually the solution in the comments further down works best:

pdftops file.pdf
ps2pdf -dSAFER -dNOPLATFONTS -sPAPERSIZE=letter -dEmbedAllFonts=true -dPDFSETTINGS=/prepress file.ps file.pdf

On FreeBSD you need poppler-utils and ghostscript to get the pftops and ps2pdf commands.

And because I had a bunch of graphs in PDF format without fonts embedded I needed a script to automate the process. Using tcsh it works like that:

cd figures
mkdir non-embedded
mv *.pdf non-embedded
foreach file (non-embedded/*.pdf)
pdftops $file
set psfile = `echo $file | cut -d"." -f1`.ps
set pdffile = `echo $file | cut -d "/" -f2
ps2pdf -dSAFER -dNOPLATFONTS -sPAPERSIZE=letter -dEmbedAllFonts=true -dPDFSETTINGS=/prepress $psfile $pdffile
end

And a similar script can be used to crop the graphs in PDF format using pdfcrop:

foreach file (*.pdf)
pdfcrop $file
set cropped = `echo $file | cut -d "." -f 1`-crop.pdf
rm -rf $file
mv $cropped $file
end

This removes all extra white space around all graphs. Again useful to handle crappy Matlab outputs.

Edit:

And here's the magic command to create a pdf with embedded fonts, optimized and 600dpi resolution (as requested by Sheridan Press for example):

pdftops file.pdf
ps2pdf -dSAFER -dNOPLATFONTS -sPAPERSIZE=letter -dEmbedAllFonts=true -dPDFSETTINGS=/prepress -dOPTIMIZE=true -dCompatibility=1.4 -r600 file.ps file.pdf

Installing a FreeBSD guest system on VirtualBox (binary version) on a Linux host

I think this solution is a good start for my blog, I also added some pics :-).

FreeBSD 8.2 was not so keen to install on VirtualBox 4.0.4  as it should, refusing to use the DVD iso I mounted and booted off from as installation medium.

Well turns out, the default settings VirtualBox provides for a FreeBSD install are no good. FreeBSD seems not to be happy with the CDROM drive being attached at an IDE adapter, so you need to switch to SATA:




Furthermore, FreeBSD doesn't seem to be happy with the EHCI USB controller of the binary VirtualBox, so you need to disable that if you want to use USB 2.0 devices in FreeBSD. They'll revert to slow USB 1.1, but at least you can access them.


And if you want to do FreeBSD development work like I do, using one or more copies of the FreeBSD source tree, you need to allocate a larger disk as well, the default 8GB will not be enough. I would suggest at least 30GB.