Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotating a PDF file by n degrees, where n is not a multiple of 90

Tags:

pdf

The problem I am facing is as following. I have a source document, src.pdf.

I need to insert the contents of src.pdf into target.pdf, rotated by n degrees, where n is NOT a multiple of 90.

Any help would be appreciated, thanks.

EDIT 1:

PDF contains no annotations.

I can use any solution which relies on utilities, or write my own code, preferably in C#/Python/Ruby/Perl, but not limited to a language.

The platform is Windows Server 2008 R2, I prefer to stick to the existing server but Linux is also an option. Latest (stable) GhostScript and pdftk are already installed.

like image 607
Roman Avatar asked Nov 27 '12 14:11

Roman


People also ask

What is the shortcut for rotating a PDF?

To make the process even easier, you can use rotate PDF shortcuts for Windows 10: Rotate clockwise — Shift+Ctrl+Plus. Rotate counterclockwise — Shift+Ctrl+Minus.


1 Answers

If a new language is not a problem, LateX could be an option. You can include a pdf as a figure in a tex file, and you will be able to use dedicated option like rescaling and rotating function. Then, compile it to obtain a new pdf. The very simple following code works for me :

\documentclass[a4paper]{article} 
\usepackage{graphicx}

\begin{document}

\includegraphics[scale=0.5,angle=10]{test.pdf} 

\end{document}

From this pdf:

str

I get this new one:

enter image description here

It will however need some manual ajustements to get exactly what you want...

like image 86
Remy F Avatar answered Oct 04 '22 15:10

Remy F