-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support SVG images in multiple formats #1793
Comments
I can't reproduce this exact error, this is my output.
|
Yeah apparently the font error is a seperate problem (I'm also getting it for .md files without images). |
Can you compile normal |
It works using |
Pandoc uses pdflatex with the following arguments from what I can see |
Same with epub/html to pdf. |
P.S. Just to note: there's no
|
Can you please post the exact output you are getting in a new ticket? |
I don't think svg is supported by pdflatex. The svg (or svgz) would need to be converted to a supported image format. We use JuicyPixels for bitmap image format conventions, but it won't help with svg. I've improved the confusing error messages in a recent commit, but I don't think there's much else that can be done now. Your path forward is to convert the svgs to pdfs with an external program. |
As a matter of fact, there is a possibility to render SVG, not directly through JuicyPixels, but I have a library called rasterific-svg for this. I was thinking of putting together a proposition to allow the use of SVG in pandoc, but I don't really know where to start. |
@Twinside, rasterizing svg for pdf output seems somewhat suboptimal, when it could be converted straight to pdf (both being vector formats and all). But I don't think there are libraries for that... |
I think it's doable, I'll have a shot at it. |
rasterific-svg 0.2.3 now support PDF output (for a better function documentation see renderSvgDocument, it uses the same parameters). |
@Twinside Do you think SVG support could be added to pandoc using your library? |
There is #2211 proposed a long time ago, providing svg rasterization or svg conversion to PDF depending on the need. Conversion to PDF didn't handle inclusion of images though. |
I'm sorry, I hadn't noticed. Thanks for the pointer. Looks like the main obstacle is the indirect dependency on lens. @jgm and @mpickering both have raised their concern on the size of the lens library, maybe this discussion can be revisited to a definite conclusion? From a quick look at the PR, it looks to me like gif and png would no longer be supported. Did I misread the change? I'll try to spend more time on this, it would be nice if we could get the issue at hand resolved. |
PNG & gif are still supported, it's the way to determine their DPI that would change, by using JuicyPixels's metadata information. But maybe I missed something (it was a loooong time ago). |
Figured I'd be missing something there, thanks.
😔 |
+1 for SVG conversion. Having real trouble finding a way of converting github markdown to PDF because of the lack of SVG support in pandoc. |
Putting this in the pandoc 2.0 milestone, so I don't forget about it. |
This would also be solved by switching the default PDF engine to ConTeXt or wkhtmltopdf... @JamesH65 you can already use |
This would also be solved by switching the default PDF engine to
ConTeXt or wkhtmltopdf...
I don't think I'd want to change the default. But it's good
to emphasize that people who use SVGs can already use `-t
context` or `-t html` with `-o output.pdf` and use these
engines, which support SVG already.
I should mention another workaround, for those who need to
support SVGs. Just use a program of your choice to convert
the SVG to PDF, so you have two images, one with an svg
extension, one with a pdf extension. Then leave off the
extensions in your Markdown source and use
`--default-image-extension` as appropriate for the output
format.
A filter would be another approach.
|
Another approach is to rely on an external dependencies, if including a big library is a concern. And since LaTeX is already an external dependency of pandoc, I guess this will be fine for many potential users of this feature. e.g. in graphics - How to include SVG diagrams in LaTeX? - TeX - LaTeX Stack Exchange, it's mentioned that there's a LaTeX package relying on external dependencies that automatically choose from a few external dependencies depending on availabilities of the system. This way, pandoc can still provide a native support without committing to a large dependency. |
Did some tests. Had good results with rsvg-convert (installed with librsvg), converting to both png and pdf. Bad results with svg2pdf. Bad results with rasterific. Tempted to shell out to rsvg-convert. |
Did you had specific bad example files? |
This one: https://upload.wikimedia.org/wikipedia/commons/3/30/Vector-based_example.svg
+++ Vincent [Aug 10 17 00:50 ]:
… Did you had specific bad example files?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, [1]view it on GitHub, or [2]mute the
thread.
References
1. #1793 (comment)
2. https://github.com/notifications/unsubscribe-auth/AAAL5Hh4X4ezeukXRYZpRkBhZ-2Dm0Fvks5sWrZUgaJpZM4DFm9V
|
Thanks, I've fixed rasterific-svg to render it correctly, even if it doesn't matter in this case. |
would it make sense to use the same approach for Docx output? |
Worth mentioning:
|
I updated pandoc to version 2.14(.1), and got this same error again. Can this be reopened, or should I make a new issue? |
@hoijui There was a regression in 2.14 with SVGs in creating PDFs. |
I'm testing pandoc's markdown to pdf conversion using this readme and command
~/.cabal/bin/pandoc README.md -o test.pdf
. However, I'm getting this error:Additionally, there's a
missfont.log
generated:At first I thought this was because of the relative links for images, but replacing them with
raw.githubusercontent.com
URLs gives the same error.Pandoc version is 1.3.11, installed from cabal, on Kubuntu 14.10.
The text was updated successfully, but these errors were encountered: