mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
306 stars 33 forks source link

when PDF to SVG, BUT have NOTHING #183

Closed skyzero-1 closed 2 years ago

skyzero-1 commented 2 years ago

win10, TexLive 2022, dvisvgm 2.13.3 test.tex CODE:

\documentclass{article}
\begin{document} 
\LaTeX 
\end{doucment} 

complie with xelatex test.tex, then

$ dvisvgm --pdf test.pdf
processing PDF file 
    graphic size: 0pt x 0pt (0mm x 0mm) 
    output written to test.svg 
1 of 1 page converted in 0.549 seconds 

open the file "test.svg" with firefox/chrome/edge, there is NOTHING!!! test.svg CODE:

<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 2.13.3 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='0pt' height='0pt' viewBox='0 0 0 0'>
<g id='page1'/>
</svg>
skyzero-1 commented 2 years ago
$ dvisvgm -V1 
dvisvgm 2.13.3 (TeX Live 2022)
------------------------------
brotli:      1.0.9
clipper:     6.2.1
fontforge:   20160721
freetype:    2.11.1
Ghostscript: 9.56.1
kpathsea:    6.3.4
potrace:     1.16
xxhash:      0.8.1
zlib:        1.2.11

Ghostscript's version is `too' new?

skyzero-1 commented 2 years ago

I got another tool to make it. Thx!

mgieseki commented 2 years ago

dvisvgm doesn't support Ghostscript's new PDF interpreter which is active by default as of GS 9.56.0. The latest dvisvgm release 2.13.4 forces GS to use the old PDF interpreter so that the conversion of PDF files should work again.

samcarter commented 2 years ago

Are there any plans to upload version 2.13.4 to ctan?

mgieseki commented 2 years ago

Yes, sure. I just forgot about it. I'll upload the recent version later today.

agrahn commented 2 years ago

I am afraid, one day in the future, the old PDF interpreter will be removed from GS. Do you plan to add support for the new one?

samcarter commented 2 years ago

@mgieseki Thanks a lot!

mgieseki commented 2 years ago

@mgieseki Thanks a lot!

You're welcome. 😄

I am afraid, one day in the future, the old PDF interpreter will be removed from GS. Do you plan to add support for the new one?

I also read the statement from the GS developers that they will remove the old interpreter as soon as the new one works reliably. Unfortunately, it seems to be impossible to redefine selected operator actions executed by the interpreter. As far as I understand the code, you can write own target devices, e.g. for creating SVG output. So, it's possible to write standalone PDF to SVG converters that way. But dvisvgm needs to hook into the interpreter to process fragments of PDF code (which might be part of PDF specials, for example) in parallel with the DVI commands. I currently don't see a way how to do that with the new interpreter. Maybe I have to dig a bit deeper into the GS code first.

agrahn commented 2 years ago

Thank you, Martin, for your reply and also for all the effort you put into this package.

mgieseki commented 2 years ago

Thanks for the nice feedback. As long as people like using dvisvgm and it helps them to create SVG files they can't easily create with other utilities, I happily keep working on it. Your animate package certainly increases the value of dvisvgm too. 😃

agrahn commented 2 years ago

Thanks again! I am trying to spread the word for using dvisvgm as much as I can. For instance, multimedia inclusion is possible and much more reliable and portable with SVG than with PDF nowadays (thanks to excellent support in current web browsers).

samcarter commented 2 years ago

@agrahn I can confirm that your advertisement campaign works, I learnt about dvisvgm from one of your magical animations :)

I am now using it to automatically create the svg images for https://github.com/samcarter/tikzlings/blob/main/README.md . Previously, I manually opened the pdf in inkscape and saved them as svg, but that was really cumbersome!

kberry commented 2 years ago

Martin, is there any way for dvisvgm users to end up passing -dNEWPDF=false to gs by some setting in their environment / config? Wondering if there is a workaround for TL users so we don't have to recompile. Thanks.

mgieseki commented 2 years ago

Hi Karl, yes, it should be possible to set NEWPDF via environment variable GS_OPTIONS, e.g. with export GS_OPTIONS=-dNEWPDF=false. Both the GS executable and the GS library consider this variable, so it should work in conjunction with dvisvgm as well.

agrahn commented 2 years ago

Disturbing news, while not that surprising: https://ghostscript.com/pipermail/gs-devel/2022-September/010582.html

mgieseki commented 2 years ago

Yes, that's annoying. I'm currently working on a replacement based on mutool. That's quite some work and needs a lot of testing.