Rotate pdf file less than 90 degree?

You can do that with ConTeXt.

  • does not rasterize
  • allows for individual angles for individual pages
  • allows for varying page sizes

Versions before 2013.10.07 09:47 had a bug which cropped the pages, so make sure you use a version including the fix.

First create a file (e.g. rotatepdf.tex) with the following content

\getfiguredimensions [\getdocumentargument{input}]
\starttext
  \dorecurse{\noffigurepages}
    {\startTEXpage
      \externalfigure
        [\getdocumentargument{input}]
        [page=\recurselevel,
         orientation=\getdocumentargument{rotation}]
    \stopTEXpage}
\stoptext

Then you can rotate a PDF using the following command line:

context --input=somefile.pdf --rotation=10 rotatepdf.tex

Here is an example output:

screenshot


I looked hard and long and could find no tool that allowed you to do this interactively that is a native PDF viewer type of tool. I did not try this but you might be able to use Inkscape or Gimp to do this. I think the only issue you'll likely run into with using them is the ability to batch rotate a multi-page document.

Even the command line tools such as PdfTk couldn't do rotation by degrees, which really surprised me.

However using ImageMagick you can rotate PDF files in 1 degree increments.

Examples

$ convert original.pdf -rotate 45 rot45.pdf

You can put any value you want in for the rotate argument. It will also take negative numbers so this is possible:

$ convert original.pdf -rotate -45 rot-45.pdf

The quality of the output will drop off dramatically using the default options so you'll likely need to include the -density switch to increase the quality of the resulting PDF file.

$ convert -density 300x300 original.pdf -rotate 45 rot45.pdf

Resulting PDF

Here's a screenshot of Evince with the resulting PDF file.

   ss of pdf


This has also been asked on stackoverflow.com.

Another option is using LaTeX:

\documentclass{standalone}
\usepackage{graphicx}

\begin{document}
\includegraphics[angle=-1.5]{odd-scan}
\end{document}

In this case, I have the file odd-scan.pdf (a slightly rotated one page scan) in the same folder as the LaTeX file rotated.tex with the content above and then I run pdflatex rotated.tex. The output is a file rotated.pdf with the PDF rotated by 1.5 degrees clockwise.

Tags:

Pdf