Hi John, Instructor account <instruc...@andrew.cmu.edu> writes: > I think the best thing to do here is create a derived backend. Filters > could work to, but you will have to parse the img link, get the pdf > file, convert it and replace the path in the link. > > with a derived backend you can get that a little more directly like > this. This code block works on a minimal example for me. I guess you > could make a little function to do the last line, and put this all in > your init files and it would work. This is a very unsophisticated format > function that does not check for attributes like width or height or link > descriptions... but, I get a png image in the html export of an org file > with a pdf image ;) > > #+BEGIN_SRC emacs-lisp > (defun my-link-format (link contents info) > (let ((type (org-element-property :type link)) > (path (org-element-property :path link))) > (cond > ((and > (string= type "file") > (string-match "\.pdf" path)) > (shell-command > (format > "convert %s %s" > path > (replace-regexp-in-string "\.pdf" ".png" path))) > (format "<img src=\"%s\">" (replace-regexp-in-string "\.pdf" ".png" > path))) > ;; anything else, we just do the regular thing > (t > (org-html-link link contents info))))) > > (org-export-define-derived-backend 'my-html 'html > :translate-alist '((link . my-link-format))) > > > (browse-url (org-export-to-file 'my-html "custom-link.html")) > #+END_SRC
That is really nice. From all solutions so far this seems to be the one to pursue. I will look into that. [...] Thanks, Andreas