Question: Once you've loaded a document:

```
public static void main(String[] args) throws IOException {
    PDDocument doc = PDDocument.load(new File("blah.pdf"));

```

How do you get the page by page printing color intent from the PDDocument? I read the docs, didn't see coverage.

Answer: 
Using `itext pdf` library (fork of an older version 4.2.1) you could do smth. like:

```
PdfReader reader = new com.lowagie.text.pdf.PdfReader(Path pathToPdf);
PRStream stream = (PRStream) reader.getCatalog().getAsDict(PdfName.DESTOUTPUTPROFILE);
if (stream != null)
 {
  byte[] destProfile = PdfReader.getStreamBytes(stream);
 }

```

For extracting the profile from each page you could iterate over each page like

```
for(int i = 1; i <= pdfReader.getNumberOfPages(); i++)
 {
  PRStream prStream = (PRStream) pdfReader.getPageN(i).getDirectObject(PdfName.DESTOUTPUTPROFILE);
 if (stream != null)
  {
   byte[] destProfile = PdfReader.getStreamBytes(stream);
  }
 }

```
I don't know whether this code help or not, after searching below links,

> 
> [How do I add an ICC to an existing PDF document](https://stackoverflow.com/questions/34138201/how-do-i-add-an-icc-to-an-existing-pdf-document)
> 
> 
> [PdfBox - PDColorSpaceFactory.createColorSpace(document, iccColorSpace) throws nullpointerexception](https://stackoverflow.com/questions/30443174/pdfbox-pdcolorspacefactory-createcolorspacedocument-icccolorspace-throws-nu)
> 
> 
> <https://pdfbox.apache.org/docs/1.8.11/javadocs/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.html>
> 
> 
> 

I found some code, check whether it help or not,

```
public static void main(String[] args) throws IOException {
  PDDocument doc = PDDocument.load(new File("blah.pdf"));

  PDDocumentCatalog cat = doc.getDocumentCatalog();
  List<PDOutputIntent> list = cat.getOutputIntents();

  PDDocumentCatalog cat = doc.getDocumentCatalog();
  COSArray cosArray = doc.getCOSObject();
  PDICCBased pdCS = new PDICCBased( cosArray );

  pdCS.getNumberOfComponents()

  static void p(String s) {
    System.out.println(s);
  }
}

```