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: 
I read the examples on "How to create/add Intents to a PDF file". I couldn't get an example on "How to get intents". Using the API/examples, I wrote the following (untested code) to get the [COSStream](https://pdfbox.apache.org/docs/2.0.3/javadocs/) object for each of the Intents. See if this is useful for you.

```
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();

  for (PDOutputIntent e : list) {
    p("PDOutputIntent Found:");
    p("Info="+e.getInfo());
    p("OutputCondition="+e.getOutputCondition());
    p("OutputConditionIdentifier="+e.getOutputConditionIdentifier());
    p("RegistryName="+e.getRegistryName());
    COSStream cstr = e.getDestOutputIntent();
  }

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

```
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);
  }
}

```