Query results lost in the exported PDF

Steps to reproduce

  1. using a vault containing more than 1k notes.
  2. create an empty note
  3. test case 1
    3.1 query for something which contains more than 40 results from more than 30 files, this is common when using the daily note to track the action items.
    3.2 export this file to the PDF
    3.3 compare the output PDF and note in Obsidian in read mode
    3.4 the query results should be identical
  4. test case 2
    4.1 copy and pastes the query in 3.1 for 20-30 times in the same note created in step 2
    4.2 export this file to the PDF
    4.3 compare the output PDF and note in Obsidian in read mode
    4.4 result:

Expected result

the PDF and note in read mode should looks the same, as in 3.4

Actual result

For every query, more than one result are missing in PDF, but the missing ones are shown correctly in Obsidian note in reading mode.

More interestingly, I observed that there is a blue bar in the following screenshot which is capture in the output PDF file. It indicates that when the PDF was generated, the query was actually not complete. And there is no wonder why some results are missing.

Environment

  • Operating system:
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v1.0.3
    Installer version: v1.0.3
    Operating system: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 21.6.0
    Login status: logged in
    Catalyst license: supporter
    Insider build toggle: on
    Live preview: on
    Legacy editor: off
    Base theme: light
    Community theme: none
    Snippets enabled: 2
    Restricted mode: off
    Plugins installed: 24
    Plugins enabled: 0

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.


Additional information

I also find a similar bug report:

However, as the moderator thought that the post is about the issue related to the 3rd party plugin, so the bug report was closed.

But I think the author of the post has already pointed out the true cause of the problem: when the PDF file is generated, the search results are not ready for output. The only difference is that, in his/her case, the search engine is DataView plugin and in my case, the build-in query command in Obsidian.

1 Like

For those who also suffer this issue, there is a work around:

  1. put query which is not shown in the original pdf (e.g. 1.pdf) into a new empty note and generate a pdf (e.g. 2.pdf) based on the new note
  2. using some pdf software merge the pdf files into one pdf

thanks

I have also encountered this bug, but since I expect to end up with some fairly large files fairly frequently, I searched for another workaround that doesn’t involve as much manual work and ended up using the Better Export PDF which works for me. I would still prefer if this bug was fixed.

1 Like

How does the better export pdf work for you?

I installed the plugin, and I can see the progress bar of the searching in the preview window. However, I didnot see the search end.

After reading the code of Better Export PDF, I find that it is possible to solve the issue by changing the marked places in the main.js of this plugin with the porper values.

In my case(see above), I change them to 2e5 2e5, 2e5 and 2e3 accordingly.

The concept that is used by this plugin seems like: better export PDF will sleep for some ms(as in 1st and 2nd marks) while let another process checks the DOM for changes at an interval defined by “interval”(at 4th mark) and within the time window with the time length of “timeout”(at 3rd mark).

So if we increase the length of time window(at 3rd mark) and corrsponding sleep time(at 1st and 2nd mark), and also increase the DOM change checking interval (at 4th mark), the different parts of the page can have enough time to be rendered properly and ready for exporting to PDF.