Unknown or ambiguous terminal type; type just ‘set terminal’ for a list

This appeared when I tried to “set terminal pdf” on Gnuplot. Im using Ubuntu 10.04.  Making the long story short, I needed to install the Maverick (10.10) packets for Gnuplot.

The direct links for those packages, depending on the arch, are amd64, gnuplot-nox and gnuplot-x11. For i386, gnuplot-nox and gnuplot-x11. Download, install and the same output should be something like

gnuplot> set terminal pdf
Terminal type set to 'pdfcairo'

and that is it!

Create a script to print a PDF booklet (nice for papers)

Hi fellows,

After a considerable time without posts I’m back with a script that I’ve been using to print papers and other documents in book format with two pages side-by-side, which it is being very useful!

Required packages:

  • psutils
  • pdftk

# usage: pdf2book 

# acroread settings: 
# [x] auto rotate and center 
# [x] choose paper source by pdf page size
# [x] use custom paper size when needed
# [x] portrait 

FILE=$(echo $1 | sed 's/.pdf//')

echo "$ pdfcrop $FILE.pdf --margins 12"
pdfcrop $FILE.pdf --margins 12

echo "$ pdftops $FILE-crop.pdf"
pdftops $FILE-crop.pdf

echo "$ psbook $FILE-crop.ps book-$FILE.ps"
psbook $FILE-crop.ps book-$FILE.ps

echo "ps2pdf book-$FILE.ps book-$FILE.pdf"
ps2pdf book-$FILE.ps book-$FILE.pdf

echo "$ pdfnup book-$FILE.pdf --nup 2x1"
pdfnup book-$FILE.pdf --nup 2x1

echo "pdftk book-$FILE-2x1.pdf cat 1-endE output ready-$FILE.pdf"
pdftk book-$FILE-2x1.pdf cat 1-endE output ready-$FILE.pdf

echo "$FILE-crop.pdf $FILE-crop.ps book-$FILE.ps book-$FILE.pdf book-$FILE-2x1.pdf"
rm $FILE-crop.pdf $FILE-crop.ps book-$FILE.ps book-$FILE.pdf book-$FILE-2x1.pdf

Basically, it first cut the blank space in the margins of the pdf using pdfcrop (which cames with pdftk), convert it to ps using pdftops (instead of pdf2ps, I’m not sure but this algorithm seems better), then it change the order of pages (put the last and the first in the page 1, the penultimate and the second in page 2 and so) with psbook (which cames with psutils package), convert back to pdf using ps2pdf, rotate 90º to print it as a portrait (standard to lpr) with pdftk and finishes removing the temporary files.


I couldn’t perform it using page-crunch, a nice tip you have posted before to print multiple pages per sheet. There is a book flag there but it put the PDF in sequential order two side per page (If I have done it right).

See ya

Page-crunch, the Linux Fineprint.

Since I’ve been using only Linux for some years I missed Fineprint a lot. It is a nice app and I’ve never found nothing similar for Linux, even with the raw psutils (that I’ve been struggling with for some weeks long) I could not have the things done the way I would like.

I was pleased with Page-crunch, a tk-based application that does a front-end to psutils with everything I wish to print pdf files maximizing the useful space. Check out the following screenshot, the interface displays the enough options for printing and visualization. With some tests, for sure, Page-crunch will provide you a nice print work. Voilà.

A page-crunch screenshot

Ubuntu : Script to format your PDF before printing


Following a script which receive the PDF filename and format it to print in Ubuntu. First it crop the empty space around the page, cutting the margins (pdfcrop). Then it put two pages side by side (pdfnup) and rotate it (pdftk) to allows to print from console (lpr). When it finishes is generated a file name ready_<file_name>.pdf

It requires the following packages:

sudo apt-get intall -y pdfcrop
sudo apt-get intall -y pdfjam
sudo apt-get intall -y pdftk

### pdf2print.sh ###

#! /bin/bash
FILE=$(echo $1 | sed ‘s/.pdf//’)
echo “pdfcrop –margins 12 $FILE.pdf”
pdfcrop “$FILE.pdf”
echo “pdfnup $FILE-crop.pdf –nup 2×1”
pdfnup $FILE-crop.pdf –nup 2×1
echo “pdftk $FILE-crop-2×1.pdf cat 1-endE output ready_$FILE.pdf”
pdftk $FILE-crop-2×1.pdf cat 1-endE output ready_$FILE.pdf
rm $FILE-crop.pdf $FILE-crop-2×1.pdf

See ya