private void ExposePerson(ColumnText mct, GEDCOMIndividualRecord iRec, string iName, float colWidth)
        {
            Paragraph pg    = new Paragraph();
            Chunk     chunk = new Chunk(iName, fBoldFont);

            chunk.SetLocalDestination(iRec.XRef);
            pg.Add(chunk);
            chunk = new Chunk(GKUtils.GetPedigreeLifeStr(iRec, PedigreeFormat.Compact), fTextFont);
            pg.Add(chunk);
            pg.KeepTogether = true;
            mct.AddElement(pg);

            // FIXME
            IImage image = fBase.Context.GetPrimaryBitmap(iRec, 0, 0, false);

            if (image != null)
            {
                itImage img = TreeChartPDFRenderer.ConvertImage(image);

                float fitWidth = colWidth * 0.5f;
                img.ScaleToFit(fitWidth, fitWidth);

                // FIXME: the moving, if the page height is insufficient for the image height

                //img.Alignment = Image.TEXTWRAP;
                img.IndentationLeft = 5f;
                img.SpacingBefore   = 5f;
                img.SpacingAfter    = 5f;

                //Paragraph imgpar = new Paragraph(new Chunk(img, 0, 0, true));
                //imgpar.KeepTogether = true;

                mct.AddElement(img);
            }

            GEDCOMIndividualRecord father, mother;
            GEDCOMFamilyRecord     fam = iRec.GetParentsFamily();

            if (fam == null)
            {
                father = null;
                mother = null;
            }
            else
            {
                father = fam.GetHusband();
                mother = fam.GetWife();
            }

            if (father != null)
            {
                pg    = new Paragraph();
                chunk = new Chunk(GKUtils.GetNameString(father, true, false), fLinkFont);
                chunk.SetLocalGoto(father.XRef);
                pg.Add(new Chunk(LangMan.LS(LSID.LSID_Father) + ": ", fTextFont)); pg.Add(chunk);
                mct.AddElement(pg);
            }

            if (mother != null)
            {
                pg    = new Paragraph();
                chunk = new Chunk(GKUtils.GetNameString(mother, true, false), fLinkFont);
                chunk.SetLocalGoto(mother.XRef);
                pg.Add(new Chunk(LangMan.LS(LSID.LSID_Mother) + ": ", fTextFont)); pg.Add(chunk);
                mct.AddElement(pg);
            }

            if (IncludeEvents && iRec.Events.Count != 0)
            {
                int num = iRec.Events.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMCustomEvent evt = iRec.Events[i];
                    if (evt.Name == "BIRT" || evt.Name == "DEAT")
                    {
                        continue;
                    }

                    string evtName = GKUtils.GetEventName(evt);
                    string evtVal  = evt.StringValue;
                    string evtDesc = GKUtils.GetEventDesc(evt, false);

                    string tmp = evtName + ": " + evtVal;
                    if (evtVal != "")
                    {
                        tmp += ", ";
                    }
                    tmp += evtDesc;

                    mct.AddElement(new Paragraph(new Chunk(tmp, fTextFont)));
                }
            }

            if (IncludeNotes && iRec.Notes.Count != 0)
            {
                int num = iRec.Notes.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMNotes note = iRec.Notes[i];
                    mct.AddElement(new Paragraph(GKUtils.MergeStrings(note.Notes), fTextFont));
                }
            }
        }
        protected override void InternalGenerate()
        {
            try
            {
                {
                    string title = "Trees Album";//LangMan.LS(LSID.LSID_TreesAlbum)

                    fDocument.AddTitle(title);
                    fDocument.AddSubject("");
                    fDocument.AddAuthor("");
                    fDocument.AddCreator(GKData.APP_TITLE);
                    fDocument.Open();

                    BaseFont baseFont = BaseFont.CreateFont(Environment.ExpandEnvironmentVariables(@"%systemroot%\fonts\Times.ttf"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                    fTitleFont   = new itFont(baseFont, 30f, itFont.BOLD);
                    fChapFont    = new itFont(baseFont, 16f, itFont.BOLD, BaseColor.BLACK);
                    fSubchapFont = new itFont(baseFont, 14f, itFont.BOLD, BaseColor.BLACK);
                    fLinkFont    = new itFont(baseFont, 8f, itFont.UNDERLINE, BaseColor.BLUE);
                    fTextFont    = new itFont(baseFont, 8f, itFont.NORMAL, BaseColor.BLACK);
                    fBoldFont    = new itFont(baseFont, 8f, itFont.BOLD, BaseColor.BLACK);
                    fSymFont     = new itFont(baseFont, 12f, itFont.BOLD, BaseColor.BLACK);

                    float halfpage = (fDocument.Top - fDocument.Bottom - (fTitleFont.Size) * 4) / 2f;
                    fDocument.Add(new Paragraph(Chunk.NEWLINE)
                    {
                        SpacingAfter = halfpage
                    });
                    fDocument.Add(new Paragraph(title, fTitleFont)
                    {
                        Alignment = Element.ALIGN_CENTER
                    });
                    fDocument.NewPage();

                    PreparePatriarchs();

                    var   itPS       = fDocument.PageSize;
                    float pageHeight = itPS.Height;
                    float pageWidth  = itPS.Width;

                    var renderer = new TreeChartPDFRenderer(pageWidth, pageHeight);
                    renderer.SetTarget(fPdfWriter.DirectContent, false);

                    // TODO: replace by local options in TreeChartBox
                    bool prevKinship = GlobalOptions.Instance.ChartOptions.Kinship;
                    GlobalOptions.Instance.ChartOptions.Kinship = false;

                    var treeBox = AppHost.Container.Resolve <ITreeChartBox>();
                    treeBox.SetRenderer(renderer);
                    treeBox.Base       = fBase;
                    treeBox.Options    = GlobalOptions.Instance.ChartOptions;
                    treeBox.DepthLimit = 3;
                    treeBox.Height     = (int)pageHeight;
                    treeBox.Width      = (int)pageWidth;

                    int num = fPatList.Count;
                    for (int i = 0; i < num; i++)
                    {
                        string iName = fPatList[i];
                        GEDCOMIndividualRecord iRec = fPatList.GetObject(i) as GEDCOMIndividualRecord;

                        treeBox.SetScale(1.0f);
                        treeBox.GenChart(iRec, TreeChartKind.ckDescendants, false);

                        ExtSize imageSize   = treeBox.GetImageSize();
                        float   scaleFactor = SysUtils.ZoomToFit(imageSize.Width,
                                                                 imageSize.Height,
                                                                 pageWidth, pageHeight);
                        scaleFactor = (scaleFactor > 1.0f) ? 1.0f : scaleFactor;

                        treeBox.SetScale(scaleFactor);
                        treeBox.RenderStatic(BackgroundMode.bmNone, true);

                        fDocument.NewPage();
                    }

                    GlobalOptions.Instance.ChartOptions.Kinship = prevKinship;
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TreesAlbumExporter.InternalGenerate(): " + ex.Message);
                throw;
            }
        }