Comparing PDF pages automatically

I needed to compare whether two PDF documents generated from the same TeX sources where different or not, since the generation method was slightly different for both.

Trying to compare it visually would be crazy, since the document contains more than 1400 pages. So I needed an automatic way to do it.

Albert Astals Cid from the poppler mailing list suggested to use pdftoppm and diff.

The way to automatically compare PDF pages was extremely easy: convert all pages to images, compare each pages and be warned only on the different ones.

After that, it only rests to check visually which differences contain those pages which have images that don’t match.

Advertisements
Posted in Digital typography, PDF, TeX. Comments Off on Comparing PDF pages automatically

Doing arithmetic in TeX

I have just discovered accidentally how to perform simple arithmetic operations in TeX:

\number\numexpr 5+5\relax

And this will print the result, not the operands.

Posted in Personal technotes, TeX. Comments Off on Doing arithmetic in TeX

\include and \input

Thanks to this comment, I have realized the main difference between \include and \input in LaTeX: \include has a page break before and after the file and \input doesn’t.

Posted in Personal technotes, TeX. Comments Off on \include and \input

Magnifying with XeTeX

When magnifying with XeTeX using the geometry package is important not to forget that the documentclass should not have the page size set on it, instead of having it set on the proper geometry option.

Posted in Personal technotes, TeX. Comments Off on Magnifying with XeTeX

How to generate a booklet from a PDF file

Using ConTeXt (taken from the imposition explanation):

\definepapersize	[filius][width=136mm, height=232mm]
\setuppapersize		[filius][A4,landscape]
\setuparranging		[2UP,doublesided]
\setuplayout [backspace=0pt,
    topspace=0pt,
       width=middle,
      height=middle,
    location=middle,
      header=0pt,
      footer=0pt,
      grid=no, marking=off]
\starttext
\insertpages
  [document.pdf][width=0pt]
\stoptext

You have to replace the document.pdf with the real file name and filius with the original paper size.

Posted in Personal technotes, TeX. Comments Off on How to generate a booklet from a PDF file