private void AddPersonCell(PdfPTable table, BadgePersonType personType, string name)
        {
            PdfPCell cell;
            Font     fontName = SelecctFontForPerson(personType);

            if (name == null)
            {
                cell = new PdfPCell()
                {
                    Colspan = 6
                };
            }
            else
            {
                cell = new PdfPCell(new Phrase(String.Format(name), fontName))
                {
                    Colspan = 6
                };
            }
            cell.FixedHeight         = 51.0f;
            cell.BorderWidth         = 0;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            table.AddCell(cell);
        }
        private Font SelecctFontForPerson(BadgePersonType personType)
        {
            Font fontName = _fontUserName;

            if (personType == BadgePersonType.organizer)
            {
                fontName = _fontOrganizerName;
            }
            if (personType == BadgePersonType.speaker)
            {
                fontName = _fontSpeakerName;
            }
            return(fontName);
        }
        /// <summary>
        /// Add user from ApplicationUser model
        /// It will determine PersonType user or admin from the usermodel and show which sessions have been joined
        /// whene user is admin it will hide sessions and show "Techday Organisatie" as admin line
        /// </summary>
        private void AddCard(float absoluteX, float absoluteY, ApplicationUser user)
        {
            string organisationLine = user.Organisation;

            if (user.Department != null && user.Department.Trim().Length > 0)
            {
                organisationLine = organisationLine + "-" + user.Department;
            }
            if (user.isAdmin)
            {
                organisationLine = "Techday Organisatie";
            }
            BadgePersonType personType = user.isAdmin ? BadgePersonType.organizer : BadgePersonType.user;

            /* create a table to put the info in */
            PdfPTable table = new PdfPTable(6);

            table.SetTotalWidth(new float[] { CardWidth / 6, CardWidth / 6, CardWidth / 6, CardWidth / 6, CardWidth / 6, CardWidth / 6 });
            table.LockedWidth = true;

            AddPersonCell(table, personType, user.Name);
            AddOrganizatonCell(table, organisationLine);
            AddPhotoCell(table);
            if (user.isAdmin)
            {
                AddEmptySessionsCells(table);
            }
            else
            {
                AddSessionsCells(table, user.ApplicationUserTijdvakken);
            }

            /* write table at specified coordinates */
            table.WriteSelectedRows(0, -1, absoluteX, absoluteY + CardHeight, _contentByte);

            /* position image in the cell for them image and event name */
            Image image = Image.GetInstance(_referenceImage);

            image.SetAbsolutePosition(absoluteX, absoluteY + 22.0f);
            _document.Add(image);
        }