-
Notifications
You must be signed in to change notification settings - Fork 530
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
Improve pdf export with vectorized #1859
Comments
I've seen tools like those. The problem is text. Text in SVG sucks, so we and many others inject a little HTML for text, which is unrenderable in these tools. See typst/svg2pdf#57 . I suppose we could do it twice. Grab a PNG of just the texts and overlay it on an SVG, but it's hairy. I'll leave it open for a OneDay task |
Hmm when I ran in on my desktop I think that it did render the text fine. It just rendered it as part of the vectorized path and not as text. The text was not selectable/embedded but instead it was still vectorized. I am away from my computer at the moment so I don't have the d2 -> svg -> pdf that is the direct output of the tool I linked above, however that tool is the library that typst uses to render svg's in their documents. I have included below a link that contains a link to a typst project that contains it rendering a few different svg's from various tools, including d2langs avg output |
Oh interesting. Will have to take another look to verify |
I think it might still need a post prossing step to add back in the hovertext |
Currently the PDF export uses playwrite to grab a PNG, this results in a rasterized image instead of a vector image, which can cause a lower quality output. I have been playing around with typst, a alternative to latex, and they have a nice svg to pdf library that renders the svg's to a pdf. It seems to do a good job with foreign objects, unlike inkscape etc... who have trouble rendering the d2 svg's. It currently doesn't render the text as text, but as paths which is a small downside. But it's output is a vectorized pdf which retains the high quality of d2 diagrams. I mainly was looking into this as I wanted to use d2 to draw diagrams for latex, but found that the pdf output ended up not looking great when imbedded in a pdf.
https://github.com/typst/svg2pdf
The text was updated successfully, but these errors were encountered: