How can I rotate a PDF file less than 90 degree under Ubuntu?
Can I do that interactively?
How can I rotate a PDF file less than 90 degree under Ubuntu?
Can I do that interactively?
You can do that with ConTeXt.
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:
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.
$ 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
Here's a screenshot of Evince with the resulting PDF file.
convert
rotate every page in a single multiple-page pdf file? @Gilles: in my case, the pdf files are created by scanning. So I think rasterizing first doesn't matter?
– Tim
Oct 05 '13 at 14:49
convert -density 300x300 original.pdf -rotate 45 rot45.pdf
to preserve the quality, but the size increases from 100KB to 2MB. What can I do to reduce the size without sacrificing the quality? I used a online compressing website http://compress.smallpdf.com/, but it takes forever to compress and hasn't finished yet.
– Tim
Oct 28 '13 at 17:31
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.
You could import it with GIMP, which includes a rotate tool and can export back to pdf.