private MemoryStream GeneratePDFStream(Participant participant)
        {
            var certificateText = CertificateGenerator.GenerateCertificateForParticipant(Certificate, participant);

            var          rotatedA4    = PageSize.A4.Rotate();
            var          doc          = new Document(rotatedA4);
            MemoryStream memoryStream = new MemoryStream();
            PdfWriter    writer       = PdfWriter.GetInstance(doc, memoryStream);

            doc.Open();
            if (BackgroundImagePath != null)
            {
                var backgroundImage = Image.GetInstance(BackgroundImagePath);
                backgroundImage.Alignment = Image.UNDERLYING;
                backgroundImage.ScaleAbsolute(rotatedA4);
                backgroundImage.SetAbsolutePosition(0, 0);

                doc.Add(backgroundImage);
            }

            using (var htmlWorker = new HTMLWorker(doc))
            {
                //HTMLWorker doesn't read a string directly but instead needs a TextReader (which StringReader subclasses)
                using (var sr = new StringReader(certificateText))
                {
                    //Parse the HTML
                    htmlWorker.Parse(sr);
                }
            }

            writer.CloseStream = false;
            doc.Close();

            memoryStream.Position = 0;

            return(memoryStream);
        }