public virtual bool SetOutputIntents(PdfReader reader, bool checkExistence)
{
PdfDictionary catalog = reader.Catalog;
PdfArray outs = catalog.GetAsArray(PdfName.OUTPUTINTENTS);
if (outs == null)
return false;
List<PdfObject> arr = outs.ArrayList;
if (outs.Size == 0)
return false;
PdfDictionary outa = outs.GetAsDict(0);
PdfObject obj = PdfReader.GetPdfObject(outa.Get(PdfName.S));
if (obj == null || !PdfName.GTS_PDFX.Equals(obj))
return false;
if (checkExistence)
return true;
PRStream stream = (PRStream)PdfReader.GetPdfObject(outa.Get(PdfName.DESTOUTPUTPROFILE));
byte[] destProfile = null;
if (stream != null) {
destProfile = PdfReader.GetStreamBytes(stream);
}
SetOutputIntents(GetNameString(outa, PdfName.OUTPUTCONDITIONIDENTIFIER), GetNameString(outa, PdfName.OUTPUTCONDITION),
GetNameString(outa, PdfName.REGISTRYNAME), GetNameString(outa, PdfName.INFO), destProfile);
return true;
}