shg / org-inline-pdf.el

Inline PDF previewing for Org
GNU General Public License v3.0
48 stars 8 forks source link

Some PDF files can't generate valid SVG image by pdf2svg #2

Closed stardiviner closed 3 years ago

stardiviner commented 3 years ago

I added similar feature to org-link-beautify which inspired by your extension.

Here is my posted issue: https://github.com/dawbarton/pdf2svg/issues/32

Have you meet same problem?

shg commented 3 years ago

Thank you for reporting the issue. Could you provide the link to the PDF that fails?

stardiviner commented 3 years ago

I solved this problem use pdftocairo command-line tool.

shg commented 3 years ago

Could you provide the PDF that you got the issue?

I have already made pdfcairo version https://github.com/shg/org-inline-pdf.el/issues/1#issue-777389968 but I'd like to investigate the problem in detail.

stardiviner commented 3 years ago

Here is the my uploaded ebook file.

shg commented 3 years ago

@stardiviner Thank you very much but unfortunately it seems downloading is not allowed without a Baidu account. I will purchase the book from the publisher when necessary so you don't need to upload it again.

By the way, actually in my environment (macOS and Firefox or Safari) I can properly see the SVG you've uploaded below without any problem.

https://gist.github.com/d01056882c721f27ca27fcb4424b6b4c

What is your OS and which browser did you use to see the SVG when you encountered the issue?

stardiviner commented 3 years ago

Yes, I can open SVG image in Emacs image-mode too. But open with feh or sxiv is black. And inline display is also black. That what weird.

stardiviner commented 3 years ago

Is there other place I can upload PDF file? I can upload PDF again

shg commented 3 years ago

@stardiviner The issue you reported is not directly related to this package so Iet me close this now.

By the way, as far as I checked feh properly shows the SVG you uploaded, with an option --conversion-timeout 1. It seems the problem you encounterd is probably not from pdf2svg but your configuration of the viewer commands. I am not sure but sxiv may not even support SVG.

It seems that pdf2svg generates a slightly older version of SVG, but still it is a valid SVG, as far as I checked.

stardiviner commented 3 years ago

Thanks, the key point is not whether command-line image viewer like feh or sxiv can open this SVG image. The key point is Emacs can open svg file in image-mode. But can't display svg file in buffer with inline image style. Anyway, let's close it now. Leave this problem away. 😄

shg commented 3 years ago

OK I understand. Well actually I obtained the book's PDF to test this, and its cover page is displayed properly as an inline image with org-inline-pdf (the current version that calls pdf2svg). Tested both on Linux and macOS. There might be some differences between your and my environments. Thank you anyway for taking your time!

stardiviner commented 3 years ago

Could it be our implmentation is different? I'm using my written package https://github.com/stardiviner/org-link-beautify which inspired from your idea to preview PDF file. Thanks. 😸

shg commented 3 years ago

So far I haven't reproduced the issue with org-inline-pdf here. The book's PDF is correctly previewed in my environments. I haven't checked your code but I guess the issue is not in elisp but in the configuration of your environment for SVG handling.

Emacs uses Imagemagick internally for some graphics format conversion. The feh command also does. You might want to check whether display command shows the problematic SVG. If it doesn't you may need to fix it.

stardiviner commented 3 years ago

Hmm, interesting, I tested, only some PDF generated svg files can't viewed, but some can view.