l1xnan / obsidian-better-export-pdf

Obsidian PDF export enhancement plugin
MIT License
311 stars 18 forks source link

An embedded note from calendar plugin is sometimes not in the preview and therefore not in the generated pdf-file #170

Closed merlinuwe closed 5 months ago

merlinuwe commented 5 months ago

If I print the file FW21A CTR (20240410-185659) with your plugin, I don't always (~ 50 %, but not an exact even-odd-issue) get the embedded calendar information ![[Kalender - FW]] in the pdf file.

FW21A CTR (20240410-185659).md

Menü.md

Kalender - FW.md

abcdef.md

The plugin for generating the calendar is this:

https://github.com/YukiGasai/obsidian-google-calendar

Resulting export-files:

without the calendar information:

FW21A CTR (20240410-185659).pdf

with the calendar information:

FW21A CTR (20240410-185659)with-calendar-information.pdf


When there is no calendar information, your preview looks like this:

image

When I press your refresh-Button, your preview looks like this and a the complete pdf-file can get exported:

image


The problem is, that I don't always see, which information is lost, because my notes are long (~ 10 pages of DIN A4) and I use some embedded notes. A good workaround would be, it the refresh-button gets pressed automatically. ;-)

l1xnan commented 5 months ago

Currently, it's not possible to accurately determine the end time of the calendar plugin rendering. The preview page is displaying results that haven't finished rendering yet. To mitigate this issue, I've added a DOM change listener. The official export feature has also reproduced this issue.

The official export feature has also reproduced this issue: image

merlinuwe commented 5 months ago

When there is a google calendar in the note, I get no preview with the latest release. (I waited for ~2 minutes.):

image

Error message: "dom not ready"

(But Obsidians native pdf export runs.)

console output:

image

image

image

image

BUT:

After deactivating supercharged links plugin

https://github.com/mdelobelle/obsidian_supercharged_links

I get a preview and a result.

l1xnan commented 5 months ago

I did not encounter this issue after installing the supercharged links plugin. It seems there is a plugin conflict. Did the old version have this problem?

merlinuwe commented 5 months ago

No, I would have noticed the many log entries.

l1xnan commented 5 months ago

I removed the logic from the previous version and just added a 3 second wait to make a temporary plugin package to see if any more conflicts occurred: better-export-pdf.zip

merlinuwe commented 5 months ago

I tried your package with FW21A CTR (20240410-185659).md

I don't see a preview with this file, even if I wait for ~2 minutes.

image

Console:

image

BTW: The plugin does not built a preview, even if I comment the critical elements out:

---
aliases:
  - CTR
  - Controlling
tags:
  - Fach
  - CTR
filename: FW21A CTR
erstellt: Mittwoch, 30. August 2023, 10:02:24 Uhr
geändert: Dienstag, 09. April 2024, 16:27:50 Uhr
updated_at: 242024-04-14T16:26:37.541+02:00
---

%% ![[Menü|Menü]] %%

%% ![[Kalender - FW]] %%

Macht Probleme mit Better Export PDF plugin!

%% ![[abcdef]] %%
merlinuwe commented 5 months ago

Good news:

  1. With the latest release 1.7.3, I now can comment out paragraphs with

%% at the beginning and end. %%

  1. The issue with the google calendar plugin seems to be solved. Great. Thank you very much.

  2. I can see a preview of an other long and complex note.

Finetuning:

I don't know, if you can control this pagebreak inside the calendar output:

image

The native obsidian pdf export has the same issues:

image


An other issue:

When I try to built a pdf-file from a note with a tasks plugin element at the end, there is no preview in your plugin and the console shows this:

```tasks
path includes {{query.file.filename}}
not done
group by heading

![image](https://github.com/l1xnan/obsidian-better-export-pdf/assets/4138869/15c3f259-629d-4d12-9b12-5e057df61893)

But this issue is not as easy to isolate, because this one works:

aliases:

1 ErsteÜberschrift

path includes {{query.file.filename}}
not done
group by heading


[muell-better-export-plugin-tasks-plugin.md](https://github.com/l1xnan/obsidian-better-export-pdf/files/14976094/muell-better-export-plugin-tasks-plugin.md)

![image](https://github.com/l1xnan/obsidian-better-export-pdf/assets/4138869/6016a053-316c-477b-bb2e-933c29c57413)

(Has it something to do with the amount of time, your plugin waits for generating the file?)

(The built in pdf export of obsidian has no problems with generating any of the testfiles.)
l1xnan commented 5 months ago

An error occurs here when a link lacks the href attribute: https://github.com/mdelobelle/obsidian_supercharged_links/blob/master/src/linkAttributes/linkAttributes.ts#L102-L103

It shouldn't have anything to do with the generation time.

l1xnan commented 5 months ago

I don't know, if you can control this pagebreak inside the calendar output:

Essentially, it's a large table. Regarding the pagination issue with large tables, the underlying PDF engine doesn't handle it well. We need to rely on upper-level pagination algorithms to handle it. Estimating the workload for this part is quite significant, and I haven't come up with a good solution yet. Hopefully, it can be resolved in version 2.

l1xnan commented 5 months ago

An error occurs here when a link lacks the href attribute:mdelobelle/obsidian_supercharged_links@master/src/linkAttributes/linkAttributes.ts#L102-L103

It shouldn't have anything to do with the generation time.

I modified the code of the obsidian_supercharged_links plugin to see if it can solve the issue. obsidian_supercharged_links.zip

merlinuwe commented 5 months ago

Good news, again: I can export the whole note with the tasks sequence.

Your change in supercharged links was successful, very impressive.

The only thing is, that the side before the output of the tasks plugin is empty.

image

(bokeh-effect only because of private data.)

l1xnan commented 5 months ago

Good news, again: I can export the whole note with the tasks sequence.

Your change in supercharged links was successful, very impressive.

The only thing is, that the side before the output of the tasks plugin is empty.

image

(bokeh-effect only because of private data.)

You might need to check the CSS properties to see if break-after is set.

https://developer.mozilla.org/en-US/docs/Web/CSS/break-after

merlinuwe commented 5 months ago

Thank you very much for making the pull request for supercharged links plugin.


I added something in the obsidian forum, because there are similar (but not the same) export issues with the native obsidian export:

https://forum.obsidian.md/t/pdf-export-of-tasks-not-all-tasks-are-in-the-exported-pdf-file/80375