[Tex/LaTex] What steps are done by XeLaTeX when compiling input files with PSTricks codes, jpeg, png, eps, pdf images

dvipsjpegps2pdfxetex

I am confused why XeLaTeX can produce a pdf output from an input file that contains PSTricks codes, PNG, JPEG, PDF, EPS images. It is the first time I use XeLaTeX and I am really surprised that I can import images from many different format in the same input file.

Usually I use latex-dvips-ps2pdf to compile my input file that contains PSTricks codes and only EPS images. If I have PNG, JPEG and PDF images, I must convert them in advance to get the EPS version.

Unfortunately, XeLaTeX runs slower than latex-dvips-ps2pdf. I don't know why. Behind the scene, what steps are actually done by XeLaTeX when compiling input files with PSTricks codes, jpeg, png, eps, pdf images?

Best Answer

JPEG, PNG and PDF are directly supported by PDF format, then they're supported by xdvipdfmx directly. xetex program reads the image files to determine the bounding boxes and produce a .xdv file, then xdvipdfmx program put the image data to PDF output file.

PDF format does not support PostScript stream, thus EPS files are converted to PDF format and then put into PDF output file. xdvipdfmx calls GhostScript to do the trick.

PSTricks pacakge also calls GhostScript to render the PostScript code. The code needed is in xdvipdfmx.con. Herbert may give more explanations.

Related Question