0

Various tools (pdftk, qpdf, etc) can rotate PDF, but only with n*90 degree angles.

ImageMagick can also rotate pdf, but it automatically converts the vectorial format to a raster one, what I do not want.

Can I somehow rotate a PDF while preserve the vectorial format?

4
  • 1
    related: stackoverflow.com/questions/13586726/…
    – A.B
    Aug 29, 2021 at 14:53
  • (I think you mean normal degrees, not grads )
    – ilkkachu
    Aug 29, 2021 at 15:07
  • @ilkkachu Right, thanks.
    – peterh
    Aug 29, 2021 at 20:38
  • @A.B The Latex looks a fine solution to me, thanks. Someone could create an answer from it (I will do it if I have time).
    – peterh
    Aug 29, 2021 at 20:39

1 Answer 1

1

One approach is to convert the pdf to svg, then rotate the svg and finally convert the rotated svg back to pdf. For instance, assuming input.pdf contains only one page.

pdf2svg input.pdf tmp.svg
mogrify -rotate 45 tmp.svg
rsvg-convert -f pdf -o output.pdf tmp.svg

The output.pdf should contain the rotated vectorial image.

If input.pdf contains multiple pages, use pdf2svg pdffile svgfile [page number] to select the desired page.

mogrify is part of the ImageMagick package, but please DO NOT USE ImageMagick convert to generate the output PDF, use rsvg-convert or mutool instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.