SVG and Postscript
Jan. 27th, 2022 11:48 amI'm still looking for lightweight alternatives to work with and display Postscript or SVG files. I've previously compiled some of the information I've found on PDF and Postscript related programs here: https://lmemsm.dreamwidth.org/3702.html As mentioned, programs such as abcm2ps, lcal, pcal and others output to Postscript. So, I wanted to find a lightweight way to view the output. The abcm2ps program can also output to SVG. One thought was to convert Postscript or SVG to PDF and view the files with mupdf. So, far I haven't found a solution I've been happy with.
I wanted to avoid heavyweight programs and dependencies such as Ghostscript and librsvg. I've been using nanosvg for SVG files. There's an example svgview utility that comes with it. SDL2_img now supports SVG using nanosvg, so you can load and view images that way. I often use picaxo for quick image viewing and since it uses SDL2_img, it's able to support display of some SVG files. I've also been experimenting with an older version of mupdf that was released under a GPLv3 license. Along with adding cbr support (thanks to a FLOSS library from sumatrapdf), I added SVG support using nanosvg. I haven't tried the latest release of mupdf, but I did try a version a few years ago and nanosvg did a better job of handling SVG files than the mupdf code at the time.
I recently found an interesting lightweight SVG to PDF converter than uses nanosvg and libharu. Thought it might be worth checking out. It's called svgtopdf: https://github.com/MichaelMorozIQDirect/svgtopdf There's also a fork with some improvements at: https://github.com/Erroneous1/svgtopdf/tree/improvement/CurveTo As in the other solutions I've tried, it works well for some SVG examples but not others. I thought it was a very clever idea though. Biggest drawback with the program is that there's no information on licensing. I can't tell whether it would qualify as a FLOSS program or not. Would be nice if the author clarified the situation. It's written for Windows, but I believe it would be fairly easy to port to other operating systems.
I haven't found the solution I've been looking for, but trying svgtopdf did give me an excuse to update my libharu build scripts. I've switched them from using cmake to using CDetect, pkgconf and make. The library builds and works quite well. Haven't tracked down all the bug fixes and patches since version 2.3.0 and I don't think there have been any official releases since then. However, if I find some other programs I need that depend on it, I'll definitely look into updating the source with some of the patches others have created for it. Seems like it could be a useful library.
I am still trying to find utilities that handle rendering abcm2ps output properly. So far, I've found no lightweight solutions. Heavyweight browsers or Ghostscript can handle the situation, but I'd really like to find alternatives that are easier to build from source and would be more efficient on very low resource computers.
Also ran across an interesting C program to concatenate PDF files called pdfconcat:
https://github.com/pts/pdfconcat
I asked on github about the license since it wasn't indicated and just found out from the developer that the license is GPLv2. Looks like a nice program. Definitely worth sharing.
If you know of other lightweight SVG, Postscript or PDF utilities or conversion programs with minimal dependencies, I'd be very interested to hear about them.
I wanted to avoid heavyweight programs and dependencies such as Ghostscript and librsvg. I've been using nanosvg for SVG files. There's an example svgview utility that comes with it. SDL2_img now supports SVG using nanosvg, so you can load and view images that way. I often use picaxo for quick image viewing and since it uses SDL2_img, it's able to support display of some SVG files. I've also been experimenting with an older version of mupdf that was released under a GPLv3 license. Along with adding cbr support (thanks to a FLOSS library from sumatrapdf), I added SVG support using nanosvg. I haven't tried the latest release of mupdf, but I did try a version a few years ago and nanosvg did a better job of handling SVG files than the mupdf code at the time.
I recently found an interesting lightweight SVG to PDF converter than uses nanosvg and libharu. Thought it might be worth checking out. It's called svgtopdf: https://github.com/MichaelMorozIQDirect/svgtopdf There's also a fork with some improvements at: https://github.com/Erroneous1/svgtopdf/tree/improvement/CurveTo As in the other solutions I've tried, it works well for some SVG examples but not others. I thought it was a very clever idea though. Biggest drawback with the program is that there's no information on licensing. I can't tell whether it would qualify as a FLOSS program or not. Would be nice if the author clarified the situation. It's written for Windows, but I believe it would be fairly easy to port to other operating systems.
I haven't found the solution I've been looking for, but trying svgtopdf did give me an excuse to update my libharu build scripts. I've switched them from using cmake to using CDetect, pkgconf and make. The library builds and works quite well. Haven't tracked down all the bug fixes and patches since version 2.3.0 and I don't think there have been any official releases since then. However, if I find some other programs I need that depend on it, I'll definitely look into updating the source with some of the patches others have created for it. Seems like it could be a useful library.
I am still trying to find utilities that handle rendering abcm2ps output properly. So far, I've found no lightweight solutions. Heavyweight browsers or Ghostscript can handle the situation, but I'd really like to find alternatives that are easier to build from source and would be more efficient on very low resource computers.
Also ran across an interesting C program to concatenate PDF files called pdfconcat:
https://github.com/pts/pdfconcat
I asked on github about the license since it wasn't indicated and just found out from the developer that the license is GPLv2. Looks like a nice program. Definitely worth sharing.
If you know of other lightweight SVG, Postscript or PDF utilities or conversion programs with minimal dependencies, I'd be very interested to hear about them.