mhbl3 / obsidian-pdf-gen

A python package to convert Obsidian Markdown files into stylish PDFs
GNU General Public License v3.0
27 stars 0 forks source link

Vault not found on iOS #3

Closed kometenstaub closed 1 year ago

kometenstaub commented 1 year ago

Wegen I execute the PDF generation from the share sheet on iOS (after having used the pickVault shortcut), it does not find the vault.

I set the vault again multiple times, but still no luck. It is located “on my iPhone” and not in iCloud.

jump: MHBL Vault not found.
WARNING:ObiPdfGen:File 'obsidian mobile switc
her.md' not found, trying to find it...
Traceback (most recent call last):
  File "/var/mobile/Containers/Data/Applicati
on/AC3DA01D-2D4C-4F83-AA93-6F3AC1ED2CF7/Libra
ry/lib/python3.11/site-packages/obsidian_pdf_
gen/generate_pdf/md_notes_pdf.py", line 193, 
in add_note
    with open(note_path, "r", encoding="utf-8
") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^
FileNotFoundError: [Errno 2] No such file or 
directory: 'obsidian mobile switcher.md'
During handling of the above exception, anoth
er exception occurred:
Traceback (most recent call last):
  File "/var/mobile/Containers/Data/Applicati
on/AC3DA01D-2D4C-4F83-AA93-6F3AC1ED2CF7/Libra
ry/bin/obsi_pdf", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/var/mobile/Containers/Data/Applicati
on/AC3DA01D-2D4C-4F83-AA93-6F3AC1ED2CF7/Libra
ry/lib/python3.11/site-packages/obsidian_pdf_
gen/generate_pdf/md_notes_pdf.py", line 1120,
 in main
    tex.add_note(args.note, note_path, use_ch
apters, include_linked_notes)
  File "/var/mobile/Containers/Data/Applicati
on/AC3DA01D-2D4C-4F83-AA93-6F3AC1ED2CF7/Libra
ry/lib/python3.11/site-packages/obsidian_pdf_
gen/generate_pdf/md_notes_pdf.py", line 205, 
in add_note
    raise FileNotFoundError(
FileNotFoundError: File 'obsidian mobile swit
cher.md' not found in current directory and s
ubdirectories
[~group]$ 

iOS 16.4.1 (20E252), security response is installed

mhbl3 commented 1 year ago

Thanks for using the tool and helping making it better! Could try to change the content of this shortcuts to the name of your vault (the one you just pickFolder)? image

Alternatively, I have added the setup of name of one's vault in the Generate Obsidian Note PDF shortcut

kometenstaub commented 1 year ago

Thank you!

At first, it prompted me to download pdflatex, which I did, and subsequently it crashed multiple times and told me that it couldn't find the file I tried to export, but then it did work at some point. I only noticed it accidentally, since it had saved the log files and the PDF in my vault root.

I tried a bit later now (and assume that the pdflatex download worked), and now the export works. One issue is that footnotes don't preserve whitespace (all is one big word, and they're not put into the footer).

mhbl3 commented 1 year ago

Hmm the crashing might be due to too much printing to the A-shell terminal. I need to take another stab at reducing it!

Could you provide an example of the footnote? I don't use them so probably don't handle them properly!

kometenstaub commented 1 year ago

Image of the PDF:

image

Content of the Markdown file:

---
created: 2023-05-19 17:50
parent:
- 
aliases: null
tags: null
publish: false
---

Hello, this is a test with a footnote.[^1]

[^1]: See this footnote.

How it looks in reading mode in Obsidian:

image

mhbl3 commented 1 year ago

Thanks a lot for all the info, I really appreciate it!

kometenstaub commented 1 year ago

Thank you for looking into it!

mhbl3 commented 1 year ago

The footnote issue should be fixed in v1.7.1. See an example here.

Try upgrading in a-shell using pip install obsidian-pdf-gen==1.7.1 and give it a shot!

kometenstaub commented 1 year ago

Thank you, I can confirm this works now.

I do have one other question: How could I remove the red rectangles around the TOC headings and the footnote (so basically everything that is linked)?

mhbl3 commented 1 year ago

That's a good point. I added a fix for that in my next code version 1.7.2. Will release that later today

mhbl3 commented 1 year ago

Should be on pypi now with pip install obsidian-pdf-gen==1.7.2

kometenstaub commented 1 year ago

Yes, I can confirm that the red rectangles are gone now. Thank you so much for your support and all the work you’ve put into this! :)