pdf

Concatenate/Combine PDF Files in Linux

I know there are lots of ways to do this. This is not a HOW-TO, but just sharing a script I made for doing this. It's a decent example of how to write a command-line utility in Python.

Since I write my cover letters and resumes in LaTeX I always need to concatenate the two together before sending it to an employer. This is very important so that the person on the other end prints out both and it makes their life easier by not having to worry about two files. For the longest time I just had a simple script that looked like this:

#!/bin/sh

Topic:

Tags:

Creating Pretty PDF Files From Latex

To create good PDF files which look good in Adobe Acrobat even at maximum zoom levels:

  1. First run latex as many times as you need to resolve all references. This will produce your final *.dvi file. Let's assume it's called myfile.dvi.
    latex myfile.tex
  2. Now that we have our myfile.dvi file, we need to convert it to postscript. This is the safest step for most applications. For example some Latex features will not appear in the document unless the *.dvi file is first converter to a Postscript (*.ps) file. One example is shading, by using the Latex shading package (available on CTAN). The "other" method I am elluding to is by converting directly to PDF by using dvipdfm or pdflatex. This usually works fine, however, I recommend going to Postscript first using dvips. You need to provide two key arguments: a) the paper size, and b) a PDF option. The paper size option is usually necessary because dvips is set up for A4 paper by default. Note, even if your postscript file looks like it fits on the page properly, it may not once you convert it to a PDF! The PDF option is necessary so that dvips includes outline fonts instead of bitmap fonts in the Postscript document. This is what will make our fonts look pretty in the final PDF document, and will allow the fonts to scale themselves when we zoom in. So the command we need to run is:
    dvips -t letter -Ppdf myfile.dvi

    This should produce some output similar to that shown below:

    This is dvips(k) 5.86e Copyright 2001 Radical Eye Software (<a href="http://www.radicaleye.com">www.radicaleye.com</a>) TeX output 2003.03.04:0123' -> myfile.ps
          <tex.pro><alt-rule.pro><texc.pro><texps.pro><special.pro>. <cmr8.pfb>
          <cmti10.pfb><cmbx10.pfb><cmbx12.pfb><cmsy10.pfb><cmr10.pfb>[1] [2] [3]

    If we had of just run:

    dvips -t letter myfile.dvi

    we would have gotten the following output:

    This is dvips(k) 5.86e Copyright 2001 Radical Eye Software (<a href="http://www.radicaleye.com">www.radicaleye.com</a>)
          ' TeX output 2003.03.04:0123' -> resume.ps
          <texc.pro><special.pro>. [1] [2] [3]
     
          The *.pfb files are font files, and they are now being included
  3. After running the above command, a myfile.ps file will have been created. It will appear larger than it did before because it will have some fonts embedded inside the document itself. Now the last step is easy. We need to run ps2pdf:
    ps2pdf myfile.ps

    This should produce a myfile.pdf file. Opening the file up with Adobe Acrobat should show that the fonts are now *pretty* and will appear very nice at 400% zoom and upwards.

Tags:

Subscribe to RSS - pdf