sawhney17 / logseq-pdf-export

MIT License
107 stars 6 forks source link

Support Image & Table #2

Closed emms007 closed 2 years ago

emms007 commented 2 years ago

We commonly use md-tables and picture in our graph. Could this be integrated in the PDF output?

Table block:

  | :---        |    :----:   |          ---: |
  | Header      | Title       | Here's this   |
  | Paragraph   | Text        | And more      |

Logseq Visual: image

The logseq special block formatters is also interesting:

#+BEGIN_IMPORTANT
hello
#+END_IMPORTANT

PDF output: image

sawhney17 commented 2 years ago

Images should already be implemented, could you send me a screenshot of the image when in edit mode?

emms007 commented 2 years ago

Sure, the block above is đź‘Ť image

and the preview generates those errors: image

sawhney17 commented 2 years ago

Which platform are you on? On 29 Mar 2022, 2:56 PM +0400, emms007 @.***>, wrote:

Sure, the block above is 👍 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

emms007 commented 2 years ago

Windows 10, usual Chrome. Nothing particular

sawhney17 commented 2 years ago

It may be a platform speciifc thing. I’ve only got the chance to test it out on macOS and it works here, but it’s probably something. to do with the way windows’ handles file paths. On 29 Mar 2022, 6:51 PM +0400, emms007 @.***>, wrote:

Windows 10, usual Chrome. Nothing particular — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

lukas-mertens commented 2 years ago

@sawhney17 This sounds like a permission problem with the file api: @emms007 most likely it is going to work, if you use logseq via the electron app. Maybe Chrome only gave permissions to the other directory and now it is not possible for the plugin to access the path ../assetsas it is one directory level higher?!

h-b commented 2 years ago

Images also do not work for me. In logseq, I write for example

![testing.svg](../assets/testing_1648672201459_0.svg){:width 300, :height 200}

which displays the image in logseq. But in the PDF it looks like this:

image

This happens also for png files. I am on Linux using Zorin OS 16.1 (based on Ubuntu focal).

Thank you.

emms007 commented 2 years ago

Checking again the problem seems easy to fix:

  1. In Logseq Electron normal image display, the path is as below: assets://E:/Documents/X.ESC/X/SyncthingCloudLink/logseq-master/assets/image_1644840950240_0.png

  2. While, in the PDF generation template, it goes out as : E:/Documents/X.ESC/X/SyncthingCloudLink/logseq-master/assets/image_1644840950240_0.png => it misses assets:// which if added works OK

h-b commented 2 years ago

Ok good to know. As I am using a synchronized logseq graph on several devices, I cannot change paths. I need to use relativ paths just as logseq generates them when uploading an image.

sawhney17 commented 2 years ago

Both of these issues should be fixed in the latest release. I've added support for tables and MD images and majorly refactored the code to use native APIs and print screens. Hopefully this should work a lot better

sawhney17 commented 1 year ago

Images should already be functioning can you send me the image link? Rather what you see when you enter edit mode for the image?

I'll see what can happen about tables On 28 Mar 2022, 12:19 PM +0400, emms007 @.***>, wrote:

We commonly use md-tables and picture in our graph. Could this be integrated in the PDF output? Table block: | :--- | :----: | ---: | | Header | Title | Here's this | | Paragraph | Text | And more | Logseq Visual: PDF output: — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sawhney17 commented 1 year ago

I'm working on a new approach to the plug-in using native electron APIs, should have a version out tomorrow which should drastically improve these. On 6 Apr 2022, 6:56 PM +0400, Stefan Zipproth @.***>, wrote:

Ok good to know. As I am using a synchronized logseq graph on several devices, I cannot change paths. I need to use relativ paths just as logseq generates them when uploading an image. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>