Comments (7)
- Looks like your R code should be generating the pdf. Are you sure that the pdf is being generated before the org-export-before-processing-hook? Because that is when the pdf file should be available if you are using that hook. To test out this theory, use a pre-generated pdf like the one I have in my mwe, and use that instead of relying on R to generate the pdf.
I thought about that too. But no, this is no what's causing the problem.
- I do not think this second point could be causing the problem, but still I'll list it. The #+HEADER is actually an org inbuilt feature for source blocks. I am reusing it for this pdf to png conversion feature.
I am glad you raised this point. Once I place =#+HEADER: :convertfrompdf t= right before the figure[[*.png]], everything works fine.
Thank you for your quick response and this awesome function!
from .emacs.d.
I just added a minimum working example in https://github.com/kaushalmodi/.emacs.d/tree/master/elisp/org-include-img-from-pdf
Check it out.
Use the same mwe org file ( https://raw.githubusercontent.com/kaushalmodi/.emacs.d/master/elisp/org-include-img-from-pdf/org-include-img-from-pdf-mwe.org ) and the associated PDF file and see if it works for you.
from .emacs.d.
Thank you very much for the mwe. It worked perfectly for me. However, I realized that if a figure is not placed at the beginning of the file like what you did, it cannot get converted. Does that happen to you as well? If so, do you plan to fix it?
Here is my example you may want to use to reproduce the error.
#+TITLE: PDF Image
#+NAME: fig:unicorn
#+HEADER: :convertfrompdf t
1. make a plot
#+BEGIN_SRC R :exports both :results graphics :file ./fig-1.pdf
plot(1:100)
#+END_SRC
[[./fig-1.png]]
from .emacs.d.
However, I realized that if a figure is not placed at the beginning of the file like what you did, it cannot get converted.
That should have worked as long as the pdf file was available.
I do not have R installed so I tried the below and that worked:
#+TITLE: PDF Image
#+NAME: fig:unicorn
#+HEADER: :convertfrompdf t
1. make a plot
[[./org-mode-unicorn-logo.png]]
Though, I am not sure why you would want to keep the #+NAME
and #+HEADER
related to that image away from the image reference.
Few things I could think of that could be causing the problem:
- Looks like your R code should be generating the pdf. Are you sure that the pdf is being generated before the
org-export-before-processing-hook
? Because that is when the pdf file should be available if you are using that hook. To test out this theory, use a pre-generated pdf like the one I have in my mwe, and use that instead of relying on R to generate the pdf. - I do not think this second point could be causing the problem, but still I'll list it. The
#+HEADER
is actually an org inbuilt feature for source blocks. I am reusing it for this pdf to png conversion feature.
from .emacs.d.
Once I place =#+HEADER: :convertfrompdf t= right before the figure[[*.png]], everything works fine.
Glad to know that you have this working. Yeah, that #+HEADER
is supposed to be specific to each figure. So it's not a bad idea to have #+HEADER
directly before the figure (along with #+NAME
and #+CAPTION
if any).
Feel free to close this issue if that is workable for you.
from .emacs.d.
Started a discussion on org mode list to learn about the best way to improve this: http://lists.gnu.org/archive/html/emacs-orgmode/2017-01/msg00260.html
from .emacs.d.
Done in db69815.
from .emacs.d.
Related Issues (20)
- find the current instance block HOT 3
- Add bash version of git_force_update.csh HOT 14
- projectile is adding .git folders to the list of known projects HOT 4
- Do not set Slant face property to italics in term mode HOT 1
- Suggestion to improve HOT 4
- Dedicated repo for eless? HOT 1
- eless: Doesn't preserve view-mode when opening file from dired HOT 1
- remove assignment of eww-search-prefix in modi/eww--go-to-first-search-result HOT 1
- seems modi/eww--go-to-first-search-result not working properly HOT 5
- modi/eww-im-feeling-lucky can be improved
- Error modi/temporary-file-directory HOT 7
- Replace focus-in-hook with new hook [emacs 27.x]
- File permissions HOT 2
- manually-synced directory HOT 4
- Opening executable tcl-files HOT 5
- Changing the hugo mode load HOT 1
- Loading 'iy-go-to-char' package HOT 1
- Loading 'interleave' package HOT 1
- Issues setting up emacs (version < 27) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from .emacs.d.