I also had this requirement. Sadly doc-view doesn't provide this functionality.
Also the image code used by emacs can't rotate images. So I created a function which utilizes ImageMagick to transform the png files stored in the cache dir and redisplay the current page:
(defun doc-view-rotate-current-page ()
"Rotate the current page by 90 degrees. Requires ImageMagick installation"
(interactive)
(when (eq major-mode 'doc-view-mode)
;; we are assuming current doc-view internals about cache-names
(let ((file-name (expand-file-name (format "page-%d.png" (doc-view-current-page)) (doc-view--current-cache-dir))))
;; assume imagemagick is installed and rotate file in-place and redisplay buffer
(call-process-shell-command "convert" nil nil nil "-rotate" "90" (concat "\"" file-name "\"") (concat "\"" file-name "\""))
(clear-image-cache)
(doc-view-goto-page (doc-view-current-page))))))
I also had this requirement. Sadly doc-view doesn't provide this functionality.
Also the image code used by emacs can't rotate images. So I created a function which utilizes ImageMagick to transform the png files stored in the cache dir and redisplay the current page: