[Tex/LaTex] Converting PDF to EPS results in low resolution rasterization

conversionepsgnuplotgraphicspdf

I have a problem with image converting for scientific manuscript. I have been using gnuplot to make graphs, using TikZ terminal, and finally generating the figure as a PDF with LaTeX. It results in a nice vector graphic image, in PDF file format (PDFLaTeX). The problem is that publishers ask for images in EPS format. When I try to convert my PDF with Imagemagick or pdf2ps, I get a low resolution rasterized image. But as far as I know eps is also a vector graphic format. I tried to set the resolution for conversion, but I get the same low resolution image. Is there a way to convert my vector graphic PDF to vector graphic EPS? Or anyone knows a way to export in eps from gnuplot with LaTeX typesetting/fonts?

Thanks,

Best Answer

Use pdftops rather than convert (from ImageMagick). The command is

pdftops -f <first-page> -l <last-page> -eps <input.pdf> <output.eps>

For example,

pdftops -f 4 -l 4 -eps input.pdf output.pdf

Simulator

Try the following to diagnose your problem.

% simulator.tex
\documentclass[preview,border=12pt]{standalone}
\usepackage{filecontents}

\begin{filecontents*}{input.tex}
\documentclass[preview,border=12pt]{standalone}
\usepackage{tikz}
\begin{document}
This is a TikZ output.
\begin{tikzpicture}
    \draw (0,0) circle (2);
\end{tikzpicture}
\tikz\fill[red] (0,0) ellipse (3pt and 5pt); is an ellipse. 
\end{document}
\end{filecontents*}

\immediate\write18{pdflatex input}
\immediate\write18{pdftops -f 1 -l 1 -eps input.pdf output.eps}

\usepackage{graphicx}
\begin{document}
I am importing EPS image.\\
\includegraphics{output}
\end{document}

enter image description here

Compile the code above with

latex -shell-escape simulator
dvips simulator
ps2pdf -dAutoRotatePages=/None simulator.ps

As ps2pdf sometimes rotates the output automatically, please use -dAutoRotatePages=/None to prevent it from doing such an unwanted rotation.

If you are using Windows, use # instead of = in -dAutoRotatePages=/None because = has a special meaning for batch files in Windows.

Very important notes

If you use opacity in your TikZ code (PSTricks code as well), for example,

\documentclass[preview,border=12pt]{standalone}
\usepackage{tikz}
\begin{document}
This is a TikZ output.
\begin{tikzpicture}
    \draw (0,0) circle (2);
\end{tikzpicture}
\tikz\fill[red,fill opacity=.5] (0,0) ellipse (3pt and 5pt); is an ellipse. 
\end{document}

then you will get a rasterized output as follows.

enter image description here

Related Question