Skip to content
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

Handle EPS images #27

Closed
pkgw opened this issue May 26, 2017 · 10 comments
Closed

Handle EPS images #27

pkgw opened this issue May 26, 2017 · 10 comments

Comments

@pkgw
Copy link
Collaborator

pkgw commented May 26, 2017

Tectonic doesn't support PostScript or EPS images: xdvipdfmx gets them into PDF files by running an external "distiller" command to convert them to PDF, which is something that we absolutely don't want to do, because Tectonic aims to be self-contained and embeddable.

If xdvipdfmx converts to PDF, presumably that’s the only technique that works, so we’d have to implement that in order to support (E)PS images. Sounds like a lot of work, unfortunately. Ideas welcome!

@durka
Copy link

durka commented Jul 14, 2017

I mean, you call out to latex and bibtex, right? Seems like calling out to epstopdf as well isn't so terrible.

@pkgw
Copy link
Collaborator Author

pkgw commented Jul 14, 2017

No, we don't. I need to find a way to communicate this more clearly, but all of the TeX and bibtex engine code is integrated into Tectonic — it's a self-contained system.

@durka
Copy link

durka commented Jul 14, 2017

What does "integrated" mean exactly though? It wasn't ported to rust...

@pkgw
Copy link
Collaborator Author

pkgw commented Jul 14, 2017

The relevant C code is compiled and linked into the Rust binary and called from the Rust code — no external binaries are invoked.

@durka
Copy link

durka commented Jul 14, 2017

Ah I see. Would it be possible to do the same with Ghostscript? That's what epstopdf really is.

@pkgw
Copy link
Collaborator Author

pkgw commented Jul 15, 2017

In principle, yes, but there are two reasons I lean against that path:

  1. I'm pretty sure that Ghostscript is very large with a lot of interactions with the broader OS environment, which would make it a lot of work to embed.
  2. I think it is fair to consider this as being beyond the scope of Tectonic, anyway. I think it makes more sense to have people convert formats before running the Tectonic engine. If this needs to be done in an automated way I'd say that the right approach is to use a build tool like ninja.

Mrmaxmeier pushed a commit to Mrmaxmeier/tectonic that referenced this issue Oct 1, 2019
@pablojimpas
Copy link

Is there any workaround for this to date?

This is an issue that prevents me from migrating my projects to tectonic

@pkgw
Copy link
Collaborator Author

pkgw commented Oct 21, 2022

Well, the situation still hasn't changed. In fact, one thing I've come to appreciate over time is that Ghostscript is generally considered to be a pretty significant security hazard these days, so I wouldn't even consider bundling it within Tectonic anymore.

My recommendation is that if you need to do image conversions such as EPS → PDF, those should happen outside of Tectonic rather than within it. So, basically, set things up to do that conversion as part of your build process before you launch Tectonic. Traditionally, the TeX ecosystem has had an opposite approach of having the engine launch tools on the fly, but I think it's not a good approach in general; it's analogous to an approach where your C compiler tries to invoke yacc for you, rather than you driving the overall build process with something like make.

One helpful thing here is that if your document has a command that looks like \includegraphics{foo}, by default Tectonic will look for foo.pdf, while a more traditional engine will look for foo.eps. So if you don't want to hardcode the file format in your TeX code, you should often be able to leave it ambiguous.

@pablojimpas
Copy link

Thanks, @pkgw! I will look into better ways of handling my build process to produce PDFs or SVGs then. I'm using EPS mainly coming from the output of PlantUML diagrams, so it should be an easy change since apparently PlantUML also generates PDFs.

@pkgw
Copy link
Collaborator Author

pkgw commented Oct 22, 2022

Glad to hear it. If anyone has any use cases where the generate-PDF-externally approach really seems unworkable, that would be good to know about, but I think I'm going to close this since I'm now fairly convinced that we shouldn't add built-in support for EPS processing.

@pkgw pkgw closed this as completed Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants