omnivore-app / obsidian-omnivore

Obsidian plugin to fetch articles and highlights from Omnivore
MIT License
813 stars 48 forks source link

Bug when importing PDF to Obsidian. #99

Closed DudeThatsErin closed 1 year ago

DudeThatsErin commented 1 year ago

I would expect to see a copy of the PDF saved to Obsidian and not the information from the PDF copied to Obsidian. It looks ridiculous lol

image

This screenshot shows exactly what I am seeing on my iPad.

jacksonh commented 1 year ago

Thanks, it looks like it grabbed our search content, not the actual PDF document here. Does this happen with all PDFs or happened with just this one?

sywhb commented 1 year ago

Hey @DudeThatsErin , there is another variable in the template: fileAttachment which could be used to export PDF as an attachment in Obsidian.

I can create an attachment using below template.

![[{{{fileAttachment}}}]]

sywhb commented 1 year ago

@jacksonh I guess I should set content to null if the type of the item is FILE so we won't pull the search content from the PDF

jacksonh commented 1 year ago

@sywhb there is a contentReader attribute that should be set to WEB for any web article. That is probably the best way to do it.

sywhb commented 1 year ago

@jacksonh sorry, I mean in Obsidian template

jacksonh commented 1 year ago

Yeah i think when generating the template values you can do something like:

content" article.contentReader === 'WEB' ? article.content : null
sywhb commented 1 year ago

Yeah!

andresrinivasan commented 1 year ago

I expected

{{#fileAttachment}}
![[{{{fileAttachment}}}]]
{{/fileAttachment}}

{{^fileAttachment}}
{{{content}}}
{{/fileAttachment}}

to accomplish the above.

{#fileAttachment}... works as expected and only renders fileAttachment for FILE content.

{^fileAttachment}... does not render the content when fileAttachment is false.

sywhb commented 1 year ago

I have created a PR #137 so that we will return content as undefined if we are syncing a PDF @jacksonh

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.6.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: