Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When exporting notes to pdf, the image resource fails to load. #19

Closed
cestbonsuliu opened this issue Apr 19, 2023 · 6 comments
Closed

Comments

@cestbonsuliu
Copy link

Problem Description

I encountered the following error when running note_export.py to export notes to PDF

WARNING:pypandoc:This document format requires a nonempty <title> element.
  Defaulting to '-' as the title.
  To specify a title, use 'title' in metadata or --metadata title="...".
ERROR: Failed to load image at 'file:///D:/PycharmProjects/pythonProject/:/8cbb74f887a64d579b65
9d164f1bdebd': OSError: Bad URL: /D|/PycharmProjects/pythonProject/|/8cbb74f887a64d579b659d164f
1bdebd
ERROR: Failed to load image at 'file:///D:/PycharmProjects/pythonProject/:/d13e4a8f680740299aaf
161958dac938': OSError: Bad URL: /D|/PycharmProjects/pythonProject/|/d13e4a8f680740299aaf161958
dac938
ERROR: Failed to load image at 'file:///D:/PycharmProjects/pythonProject/:/44eac417e2c74aacafa6
a6d8973f77e4': OSError: Bad URL: /D|/PycharmProjects/pythonProject/|/44eac417e2c74aacafa6a6d897
3f77e4

image

The code block does not render well and the image fails to load. How can I solve this problem?

@marph91
Copy link
Owner

marph91 commented Apr 19, 2023

Hi @cestbonsuliu,

I could reproduce this with an image like ![](:/<some_hash>). It simply wasn't implemented. I think it's fixed on the current master. Could you try again?

marph91 added a commit that referenced this issue Apr 19, 2023
@cestbonsuliu
Copy link
Author

Thank you very much for the quick improvement! I will try again when my work is done

@cestbonsuliu
Copy link
Author

hey bro, sorry for the delay of a few days. After my testing I found that there are still problems with.

Execute the following code:

note = api.get_note(id_=candidate.id, fields="body")

Got the body of the note:

"
应用布局”视图中,可以看到应用程序添加这些拆分器的位置。

![d04840c9e13f308719809a495b4d536e.png](:/22ada25077f944c6ae999daf40bd8988)

/* remove white border (~5px, right) from columns with one panel */
.rli-root > .resizableLayoutItem > div {
  width: 100% !important;
}
/* remove white border (~5px, right, below) from columns with two or more panels */
.rli-root > .resizableLayoutItem > .resizableLayoutItem > div {
  height: 100% !important;
  width: 100% !important;
}
/* remove small border (1px, below) plugin iframes */
div.resizableLayoutItem iframe {
  border-bottom: none !important;
}

会导致插件出现问题,如下

![fa0e980914c7ef6e4be4dac3acec9b6c.png](:/55dfd6b9efe14dafb2a619950de86d18)

"

The problems in the final obtained pdf:

  • Image cannot be displayed

image

image

[WARNING] WARNING: Ignored `text-rendering: optimizeLegibility` at 15:7, unknown property.
WARNING: Expected a media type, got '(max-width: 600px)'
WARNING: Invalid media type ' (max-width: 600px) ' the whole @media rule was ignored at 18:5.
WARNING: Ignored `overflow-x: auto` at 108:7, unknown property.
WARNING: Ignored `gap: min(4vw, 1.5em)` at 145:32, unknown property.
WARNING: Ignored `overflow-x: auto` at 146:28, unknown property.
ERROR: Failed to load image at 'C:%5CUsers%5Cadmin%5CAppData%5CLocal%5CTemp%5Ctmphj9p5h13/22ada
25077f944c6ae999daf40bd8988': ValueError: Not an absolute URI: 'C:%5CUsers%5Cadmin%5CAppData%5C
Local%5CTemp%5Ctmphj9p5h13/22ada25077f944c6ae999daf40bd8988'
ERROR: Failed to load image at 'C:%5CUsers%5Cadmin%5CAppData%5CLocal%5CTemp%5Ctmphj9p5h13/55dfd
6b9efe14dafb2a619950de86d18': ValueError: Not an absolute URI: 'C:%5CUsers%5Cadmin%5CAppData%5C
Local%5CTemp%5Ctmphj9p5h13/55dfd6b9efe14dafb2a619950de86d18'

WARNING:pypandoc:WARNING: Ignored `text-rendering: optimizeLegibility` at 15:7, unknown propert
y.
WARNING: Expected a media type, got '(max-width: 600px)'
WARNING: Invalid media type ' (max-width: 600px) ' the whole @media rule was ignored at 18:5.
WARNING: Ignored `overflow-x: auto` at 108:7, unknown property.
WARNING: Ignored `gap: min(4vw, 1.5em)` at 145:32, unknown property.
WARNING: Ignored `overflow-x: auto` at 146:28, unknown property.
ERROR: Failed to load image at 'C:%5CUsers%5Cadmin%5CAppData%5CLocal%5CTemp%5Ctmphj9p5h13/22ada
25077f944c6ae999daf40bd8988': ValueError: Not an absolute URI: 'C:%5CUsers%5Cadmin%5CAppData%5C
Local%5CTemp%5Ctmphj9p5h13/22ada25077f944c6ae999daf40bd8988'
ERROR: Failed to load image at 'C:%5CUsers%5Cadmin%5CAppData%5CLocal%5CTemp%5Ctmphj9p5h13/55dfd
6b9efe14dafb2a619950de86d18': ValueError: Not an absolute URI: 'C:%5CUsers%5Cadmin%5CAppData%5C
Local%5CTemp%5Ctmphj9p5h13/55dfd6b9efe14dafb2a619950de86d18'

  • Code blocks not highlighted

image

@marph91
Copy link
Owner

marph91 commented Apr 23, 2023

Ah, I see. On my linux machine it works, but I can reproduce in a windows VM. I can probably take a look at the issue this week.

@marph91
Copy link
Owner

marph91 commented Apr 29, 2023

@cestbonsuliu Could you test once more? It should be fixed on master (at least on my windows VM). I didn't use the file protocol properly.

Two remarks (not directly related to the issue):

Edit: Both remarks should be fixed by css tweaks in 06d96e7.

@cestbonsuliu
Copy link
Author

I'm happy to report that the feature implementation was successful.I really appreciate your prompt and thorough assistance with my Github issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants