internal PdfCatalog GetCatalog(PdfIndirectReference pages)
{
PdfCatalog catalog = new PdfCatalog(pages, writer);
// [C1] outlines
if (rootOutline.Kids.Count > 0) {
catalog.Put(PdfName.PAGEMODE, PdfName.USEOUTLINES);
catalog.Put(PdfName.OUTLINES, rootOutline.IndirectReference);
}
// [C2] version
writer.GetPdfVersion().AddToCatalog(catalog);
// [C3] preferences
viewerPreferences.AddToCatalog(catalog);
// [C4] pagelabels
if (pageLabels != null) {
catalog.Put(PdfName.PAGELABELS, pageLabels.GetDictionary(writer));
}
// [C5] named objects
catalog.AddNames(localDestinations, GetDocumentLevelJS(), documentFileAttachment, writer);
// [C6] actions
if (openActionName != null) {
PdfAction action = GetLocalGotoAction(openActionName);
catalog.OpenAction = action;
}
else if (openActionAction != null)
catalog.OpenAction = openActionAction;
if (additionalActions != null) {
catalog.AdditionalActions = additionalActions;
}
// [C7] portable collections
if (collection != null) {
catalog.Put(PdfName.COLLECTION, collection);
}
// [C8] AcroForm
if (annotationsImp.HasValidAcroForm()) {
catalog.Put(PdfName.ACROFORM, writer.AddToBody(annotationsImp.AcroForm).IndirectReference);
}
return catalog;
}