1

I would like to use org-download-screenshot (or some other function) in combination with pdf-tools.

This works quite well out of the box. What I am missing is a enhanced renaming of the screenshot. That means, the png file should should be placed in the subdirectory ./img and be renamed according the name of the pdf file (e.g. first 10 characters) and the page of the pdf.

An alternative which I am using is on macos is this function

(defun screenShot_org()
  (interactive)
  (if buffer-file-name
      (progn
        (message "Waiting for region selection with mouse...")
        (let ((filename
               (concat 
                (read-file-name "Enter PNG Name:")
                "_"
                (format-time-string "%Y%m%d_%H%M%S") ".png")))
          (call-process "screencapture" nil nil nil "-s" filename)
          (insert (concat "
#+NAME: 
#+ATTR_ORG: :width 200
#+ATTR_LATEX: :width 0.9\\linewidth
[[file:img/" (file-name-nondirectory filename)"]]"))
                    )
        (message "File created and linked...")
        )
    (message "You're in a not saved buffer! Save it first!")
    )
  )

This basically asks for the file path and first part of the name, but does not recognize the pdf file name nor the pdf page number.

I hope it is clear, what I want to achieve...

Your Answer

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

Browse other questions tagged or ask your own question.