* @throws IOException in case of an I/O problem
*/
private void addPDFA1OutputIntent() throws IOException {
PDFOutputIntent outputIntent = pdfDoc.getFactory().makeOutputIntent();
outputIntent.setSubtype(PDFOutputIntent.GTS_PDFA1);
PDFICCStream icc = pdfDoc.getFactory().makePDFICCStream();
ICC_Profile profile;
InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
if (in != null) {
try {
profile = ICC_Profile.getInstance(in);
} finally {
IOUtils.closeQuietly(in);
}
} else {
//Fallback: Use the sRGB profile from the JRE (about 140KB)
profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
}
String desc = getICCProfileDescription(profile);
icc.setColorSpace(profile, null);
outputIntent.setDestOutputProfile(icc);
outputIntent.setOutputConditionIdentifier(desc);
outputIntent.setInfo(outputIntent.getOutputConditionIdentifier());
pdfDoc.getRoot().addOutputIntent(outputIntent);
}