public void Execute(RenderPdfInput inputTo,
                            IRespondWithSuccessOrError <IFileOutput, ErrorOutput> presenter)
        {
            var output = _pdfGateway.ConvertToPdf(inputTo);

            if (Render_Errors(output))
            {
                Respond_With_Errors(presenter, output);
                return;
            }

            Respond_With_Pdf(inputTo, presenter, output);
        }
        private static RenderPdfInput Create_Pdf_Input(PropertyPresenter <IFileOutput, ErrorOutput> docxPresenter)
        {
            var input = new RenderPdfInput();

            using (var stream = docxPresenter.SuccessContent.GetStream())
            {
                using (var memoryStream = new MemoryStream())
                {
                    stream.CopyTo(memoryStream);
                    var reportBytes = memoryStream.ToArray();
                    input.Base64DocxReport = Convert.ToBase64String(reportBytes);
                }
            }
            return(input);
        }
 private void Respond_With_Pdf(RenderPdfInput inputTo,
                               IRespondWithSuccessOrError <IFileOutput, ErrorOutput> presenter,
                               RenderedDocumentOutput output)
 {
     presenter.Respond(new PdfFileOutput(inputTo.FileName, output.FetchDocumentAsByteArray()));
 }