Is it possible to provide different versions of an image/figure, and have the pdf viewer choose which one is the best at viewing time?

I would like to have a color image on screen and on color printers, and a grayscale image on a black and white printer.

  • 5
    Compile two different documents, much easier. Otherwise you need to go into javascript, which not all viewers can use. – zeroth Mar 20 '14 at 13:52
  • 1
    I second @zeroth, but will note that Ghostscript/ImageMagick can be very useful here. – Sean Allred Mar 24 '14 at 3:18

Strictly technically speaking, yes, PDF (beginning from version 1.3) supports alternate images (eventually from remote resources) with different resolutions and colour spaces in order to let the PDF viewer choose which version to use depending on the destination device (screen, colour printer, grayscale printer). Certain substandards (e.g. PDF/A) might not support these feature, though. (See Section Alternate Images, Document management — Portable document format — Part 1: PDF 1.7, Adobe Systems Incorporated, 2008)

In practice though, unfortunately, there seems to be no support for this valuable feature in the Latex- or "open-source PDF"-World, so to speak. Some professional proprietary products (e.g. Adobe Illustrator) do support this feature though. Supposedly creating the "dual-colour-space" images/figures in Illustrator if possible and including those PDFs in your Latex-Document might produce the result you are looking for... maybe.

A trade-off between native alternate images and multiple versions of the document (latter of which is not suitable for paper submission to conferences, e.g.) could be Optional Content Groups (OCG) (starting from PDF 1.5... I think). Those can be produced with the package ocgx but would still require the user to select the correct layer/OCG (colour vs. grayscale e.g.). OCGs are not (yet) supported by all viewers, but those viewers known for maximum coformity (e.g. Adobe Reader, Foxit Reader, Okular) do support OCGs.

  • Addendum (for the sake of completeness): Apparently even Adobe Reader does not choose the alternate image with the colourspace corresponding to the output device (at least it does not in the case of grayscale printing on a colour printer). The only diffrerence made is between Print and View which is supported by pdflatex (tex.stackexchange.com/questions/68891/…) (but only for bitmap graphics). OCGs can provide ("automatic") layers for Print and View, too (which is not limited to bitmap graphics). But that does not solve your problem per se. – Pierre Schroeder Mar 26 '14 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.