obsidian-pandoc icon indicating copy to clipboard operation
obsidian-pandoc copied to clipboard

Error when exporting image in file to .docx, saying "could not fetch resource" and "does not exist" (although it does)

Open ReaderGuy42 opened this issue 3 years ago • 29 comments

error

I have a file that I transclude an image into, which works when I export it to PDF, but when I try doing the same with Pandoc to turn it into a docx file, I get this error message.

Any ideas? Thanks!

ReaderGuy42 avatar Aug 24 '21 17:08 ReaderGuy42

yeah me too having the problem if the asset folder is changed inside the obsidian settings. i am using this settings inside obsidian.

image

if the assets are in default directory that is in the vault location then it will export the image with out any problem

[request to author] kindly bring compatibility with other folder pls

[great plugin]

thank you for this great plugin which improved the workflow to a great extend

ananthuthilakan avatar Aug 26 '21 10:08 ananthuthilakan

What's really weird is that the commandline version printed in the Obsidian error works for me, only if I run it from the commandline:

pandoc --from markdown --to pdf -o /path/to/vault/test_figure_captions.pdf --pdf-engine=xelatex /path/to/vault/test_figure_captions.md --template=paper_template.tex --resource-path="/path/to/vault/resources" --filter pandoc-fignos --filter pandoc-eqnos --citeproc

My entire markdown is here, with the resources folder under the vault (doesn't seem to work wherever I put the image files). I can't get it to fetch the images at all, with either a pdf or docx export.

# Testing
Here is a test

![Original images](original_images.png){#fig:orig}

Some more text for Figure @fig:orig.

bblais avatar Sep 01 '21 16:09 bblais

As of now i am using imagegur plugin , and it will work like charm along with pandoc plugin

ananthuthilakan avatar Sep 02 '21 12:09 ananthuthilakan

As of now i am using imagegur plugin , and it will work like charm along with pandoc plugin

Doesn't that upload and then embed the images? What if I don't want it to upload my images?

ReaderGuy42 avatar Sep 02 '21 15:09 ReaderGuy42

Not sure if this is precisely the same case, but don't wan to add duI was testing poking around a bit today to help someone on discord, and found I also could not get image exports to work, although I could've sworn they did in the past. In my case, I believe the issue is related to the plugin's HTML conversion?

  • Attachments are stored in their own folder, specified in Obsidian's settings.
  • Using Obsidian/wikilink type image embed, e.g. ![[Pasted image 20210910174911.png]]
  • Using the "Export from HTML" plugin setting
  • Get "could not fetch resource" / "openBinaryFile: does not exist" errors
  • Error text indicates that Pandoc is looking for the images in the root folder, not the attachments folder
  • If I move the images to the root folder, the export will work
  • If I add the folder path into the image embed, the export will work, e.g. ![[Attachments/Pasted image 20210910174911.png]]
  • If I add a --resource-path argument in the plugin, the export will fail when using the "Export from HTML" plugin setting, but will succeed if I change the image embed to standard markdown and use the "Export from Markdown" plugin setting.

image

kukkurovaca avatar Sep 11 '21 01:09 kukkurovaca

Not sure if this is precisely the same case, but don't wan to add duI was testing poking around a bit today to help someone on discord, and found I also could not get image exports to work, although I could've sworn they did in the past. In my case, I believe the issue is related to the plugin's HTML conversion?

* Attachments are stored in their own folder, specified in Obsidian's settings.

* Using Obsidian/wikilink type image embed, e.g. `![[Pasted image 20210910174911.png]]`

* Using the "Export from HTML" plugin setting

* Get "could not fetch resource" / "openBinaryFile: does not exist" errors

* Error text indicates that Pandoc is looking for the images in the root folder, not the attachments folder

* If I move the images to the root folder, the export will work

* If I add the folder path into the image embed, the export will work, e.g. `![[Attachments/Pasted image 20210910174911.png]]`

* If I add a `--resource-path` argument in the plugin, the export will fail when using the "Export from HTML" plugin setting, **but** will succeed if I change the image embed to standard markdown and use the "Export from Markdown" plugin setting.

image

I am having exactly the problem with yours. Do you think there is any way to change all the links of the images at one time?

yizhilll avatar Sep 11 '21 09:09 yizhilll

I am having exactly the problem with yours. Do you think there is any way to change all the links of the images at one time?

Ozan's image in editor plugin has a batch convert function to do this, but I haven't tried it myself yet.

https://github.com/ozntel/oz-image-in-editor-obsidian

kukkurovaca avatar Sep 11 '21 18:09 kukkurovaca

Same problem. Please kindly fix :)

mturilin avatar Oct 01 '21 23:10 mturilin

I have the same problem even with markdown links and link to a folder (using a iCloud Drive folder). Export to HTML works but exporting to DocX does not.

universvm avatar Oct 12 '21 20:10 universvm

Hi, have there been any updates on this? Thanks :)

ReaderGuy42 avatar Oct 21 '21 13:10 ReaderGuy42

I'm not sure it applies here but I can confirm

  1. the plugin seems to have a problem in the settings with spaces in the values of extra parameters like --resource-path see issues #66 and #81
  2. the ![[]] syntax fails to produce images in the pandoc export. Changing it to equivalent []() solves the problem (specifying a filter in Pandoc could remedy this or even beter transforming this in the plugin)

I did find a workaround for (path) spaces in plugin settings

ndegroot avatar Jan 14 '22 22:01 ndegroot

Same problem here, interestingly it does find some of the files but not all of them. Would be amazing to see a fix for this. Great plugin so far!

Update: If you use pandoc in the regular cli style and place images with regular markdown ![caption](./relative/path/to/file) it works.

maxfrischknecht avatar Jan 26 '22 11:01 maxfrischknecht

Same series of issues - image seems to have to be in the same folder as the document, but also running into errors as above when exporting Word

dmje avatar Jan 31 '22 21:01 dmje

I had this same issue, I figured out solution for me.

by changing "New Link Format" to "Absolute path in vault" from Options --> Files & Links, worked for me.

Also my current settings for "Default location for new notes" is "Same folder as current file", this is not mandatory but just in case if solution doesn't work try changing this as well.

HammadShamsi avatar Feb 18 '22 21:02 HammadShamsi

@HammadShamsi thank you for the tip. I changed my "New Link Format setting to "Relative path to file" which also works and also safeguards the links should I later move the files.

djwashb avatar Mar 11 '22 05:03 djwashb

I have tried several versions of the pandoc plugin for obsidian. Finally, the version 0.1.1 was found to work for exporting docx file. Comparatively, can we improve the new version 0.2.5 based on 0.1.1? If anybody can fix 0.2.5, please let me know. Thank you!

aoqqf avatar Mar 18 '22 07:03 aoqqf

Hi everyone, check out this thread and the forks/new versions of the plugin linked there: https://github.com/OliverBalfour/obsidian-pandoc/issues/88

ReaderGuy42 avatar Mar 18 '22 09:03 ReaderGuy42

"the ![[]] syntax fails to produce images in the pandoc export. Changing it to equivalent " can't work for me. Is there anything else I have to do. The pandoc version is 0.2.5 for me.

aoqqf avatar Mar 18 '22 10:03 aoqqf

@aoqqf I think you will find that changing the new link format settings to "Absolute path in vault" or "Relative path to file" should work. For any old notes created prior to this setting being in place you will need to edit the links to set them to the new format.

djwashb avatar Mar 21 '22 03:03 djwashb

After numerous attempts, I managed to solve this problem in the simplest way I expected. I uninstalled the plugin, restarted the computer and reinstalled the plugin. I also followed the tip to change new link format settings: "Relative path to file". In my case, Mac Os (old version), it worked.

HashReb avatar Apr 28 '22 12:04 HashReb

Actually, relative paths can be supported by simply appending +rebase_relative_paths to -f <input.format> in the following, but you may want to add a preference menu switch for toggling this extension.

https://github.com/OliverBalfour/obsidian-pandoc/blob/8229273d854461b78d8606ba4136bf8018a478fa/pandoc.ts#L113-L116

see https://github.com/jgm/pandoc/issues/3752#issuecomment-1004352568

rxian avatar May 26 '22 08:05 rxian

I'm experiencing this now. This plug in is rather useless if basic Obsidian workflow makes it impossible to export. Who wants to move all files to the root directory? Or change every single transmuted link?!!

epipheus avatar Jun 21 '22 00:06 epipheus

I'm experiencing this now. This plug in is rather useless if basic Obsidian workflow makes it impossible to export. Who wants to move all files to the root directory? Or change every single transmuted link?!!

I agree, I don't know how people have managed to get this plugin to work.

My workaround was to either using pandoc from terminal or use https://github.com/mokeyish/obsidian-enhancing-export .

This plugin fails with spaces in paths so I'm not able to use it with my vault being on iCloud.

To get around the images issue, you can specify the resource_path which is where the images will be obtained from (or your .bib file):

--resource-path ~/Library/Mobile\ Documents/com~apple~CloudDocs/ --resource-path ~/Library/Mobile\ Documents/iCloud\~md\~obsidian/Documents/{path_to_your_vault}/{img_folder_in_your_vault} --citeproc --bibliography="export-data.bib" --pdf-engine=/Library/TeX/texbin/pdflatex

universvm avatar Jun 21 '22 08:06 universvm

Hi, you can check out this thread here https://github.com/OliverBalfour/obsidian-pandoc/issues/88 where people discussed how to proceed with the plugin. Most important, I think, is the fork by phillipjohnston here https://github.com/phillipjohnston/obsidian-pandoc that you can install via BRAT. Then the plugin should work as advertised. At least it did for me.

ReaderGuy42 avatar Jun 21 '22 08:06 ReaderGuy42

Seems we're dealing with an issue of how Obsidian records the file path in the markup, and then pandoc is not getting what it needs, this issue is still open. I preferably hope this is solved with an approach that can support images stored in a subfolder of the main folder that's being generated from. I think that will simplify organisation and also simplify what Markup needs be included.

A WORKAROUND WITH SOME MANUAL WORK: After a bunch of jumping around I've got this working for myself (It still has some manual work involved when I add each image) but at least images are generating for me now. Here's an alpha release of a small guide I've started working on with a way to get images outputting. https://github.com/evolve2k/obsidian-pandoc-academic-word-doc-guide/#2-embeds-your-images

evolve2k avatar Oct 23 '22 02:10 evolve2k

Well I'll appreciate if u get this of the phone I know it's on here some please get it off

Nobleking85 avatar Dec 06 '22 09:12 Nobleking85

Well I'll appreciate if u get this of the phone I know it's on here some please get it off

Hi. İn the files pref. Use absolutr path and turn of wiki links.

hakantetik avatar Dec 06 '22 10:12 hakantetik

@hakantetik That's what I'm doing, but now it says "could not fetch resource". Really confused now.

twinblade02 avatar Feb 11 '24 19:02 twinblade02