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
Text in pdf (converted from svg) always appears on top #147
Comments
Thanks for raising the issue @ohmyarch, we should list this as a known limitation in the README. As context, how are you using vl-convert, and in what kind of situation is this limitation causing issues for you? |
Draw a vector map to svg, and then use vl-convert-pdf to output it to pdf. Some elements in the map, such as titles and legends, need to be overlaid on the base map. But there may be text labels on the base map below them. Therefore, in similar scenarios, this bug or limitation will cause some display confusion. |
By the way, can this problem be avoided by using the original version of svg2pdf? I have a confusion about it. Its documentation tells me that text will be converted into shapes, but the same svg, such as the above example, only retains text elements, and uses svg2pdf to output, there will be nothing on the pdf. |
Yeah, svg2pdf by itself will convert text to paths and should preserve proper layering of text under shapes. vl-convert-pdf first runs svg2pdf without converting text to paths, so that svg2pdf renders everything except text. Then it performs its own logic to embed and overlay the text. The long term solution here is probably to integrate text embedding logic into svg2pdf, but that will take a bit of effort. See typst/svg2pdf#21 for more background. |
Text embedding has been merged into svg2pdf in typst/svg2pdf#64 (thanks @LaurenzV!), so after the next svg2pdf release we should be able to switch to this and drop our |
Yeah, it should work just like that now! Also feel free to test it, if you want to try it before the release. The only caveat right now is that if a CFF font is selected for some text, it might result in rather large file sizes (see also typst/svg2pdf#66). But it should work pretty well otherwise, all test cases that worked before still work now. Not sure when the next release will be though, first we need a new |
Thanks for the context @LaurenzV! No rush from our side, I'll keep an eye out for release notifications. And I'll let you know if I find time to test it out before release. |
svg:
pdf:
The text was updated successfully, but these errors were encountered: