add tag
निरंजन
I am supposed to give some PDF files for printing. Printers in my town still use the old technology and hence they require PDFs with CMYK color model and shapes converted to paths/curves. I have heard that PDF/A is a good and self-contained format, but unfortunately print shops are not accepting it. So I need to follow the old root. I have figured out how to convert to paths, I have also figured out how to use CMYK colors in LaTeX, i.e., `\usepackage[cmyk]{xcolor}`, but I still want to be able to "see" if the colors used are really cmyk or not. Does anyone know any reliable method for verifying this? I am on GNU Linux. I don't use proprietary software. So any software recommendation is highly welcome. Any of CLI or GUI tools are okay.
Top Answer
Udi Fogiel
If I understand correctly. the question is about verification of the color scheme used in a PDF.   
  
You can produce an uncompressed PDF, in LaTeX you can do that by adding the line `\DocumentMetadata{uncompress}` before `\documentclass`.   
  
Then you can simply open the PDF with a text editor you like, and check the color scheme that is specified. You can find information about how to analyze to content of a PDF in the [PDF specification manual](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjZ2My90ouCAxX3VaQEHUyQCF4QFnoECBQQAQ&url=https%3A%2F%2Fdeveloper.adobe.com%2Fdocument-services%2Fdocs%2Fassets%2F5b15559b96303194340b99820d3a70fa%2FPDF_ISO_32000-2.pdf&usg=AOvVaw2r3qJ723BWSsmYINaPMgcs&opi=89978449) (specifically sections 8.5 - Path Construction and Painting and 8.6 - Colour Spaces).

For example, consider the result PDF of the following LaTeX file, when compiled with pdfTeX (the `xmp=false` is just to remove some information `\DocumentMetadata` adds by default that is not related to this discussion)

```
\DocumentMetadata{uncompress,xmp=false}
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\textcolor{blue}{Test}
\end{document}
```

The text stream contains the following lines 
```
BT
/F28 9.9626 Tf 148.712 657.235 Td [(T)83(est)]TJ
0 0 1 rg 0 0 1 RG
 [-333(T)83(est)]TJ
0 g 0 G
0 g 0 G
 154.421 -567.87 Td [(1)]TJ
0 g 0 G
ET
```

There is a detailed explanation in section chapter 9 about text streams, for all we need to know here is that `Tf` determines the font and font size, `Td` is the position (translation to be more specific) and `TJ` accept an array containing strings and kerning information, and prints the corresponding glyphs using the current text *and graphics* parameters.

In this example, the text parameters are the font and font size (`F28 9.9626 Tf`), and the graphics parameters are the color (the `g`, `G`, `rg` and `RG` parameters).

As you can see, by default, color defines the color `blue` in rgb, but defines the default black color in gray scale. 

Compare that with the following

```
\DocumentMetadata{uncompress,xmp=false}
\documentclass{article}
\usepackage[cmyk]{xcolor}
\begin{document}
Test \textcolor{blue}{Test}
\end{document}
```

which contains
```
BT
/F28 9.9626 Tf 148.712 657.235 Td [(T)83(est)]TJ
1 1 0 0 k 1 1 0 0 K
 [-333(T)83(est)]TJ
0 0 0 1 k 0 0 0 1 K
0 0 0 1 k 0 0 0 1 K
 154.421 -567.87 Td [(1)]TJ
0 0 0 1 k 0 0 0 1 K
ET
```

As you can see, in this case only `k` and `K` operators were used, as desired. 

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.