Exemplo n.º 1
0
        public MemoryStream CreateList(CMWCouncilActionsPortfolio portfolio)
        {

            using (MemoryStream output = new MemoryStream())
            {
                if (portfolio.Applications.Count < 1)
                    return output;

                float[] margins = { MarginLeft.ToPts(), MarginRight.ToPts(), MarginTop.ToPts(), MarginBottom.ToPts() };
                document = new it.Document(it.PageSize.LETTER, margins[0], margins[1], margins[2], margins[3]);
                writer = PdfWriter.GetInstance(document, output);
                // writer listens to changes in doc & associate doc to output stream

                writer.SetTagged();
                writer.Tabs = PdfName.S;
                // enable marked content
                SetMetaDataTitle(Strategy, portfolio.Applications);
                SetMetaData(output);
                // set metadata   

                document.Open();
                // open the document 

                float dHeight = document.PageSize.Height;
                float dWidth = document.PageSize.Width;

                var treeRoot = writer.StructureTreeRoot;
                content = writer.DirectContent;
                under = writer.DirectContentUnder;

                // Main Tag
                root = new PdfStructureElement(treeRoot, new PdfName("Document"));
                content.BeginMarkedContentSequence(root);
                content.EndMarkedContentSequence();
                int total = writer.PageNumber;

                // Write Cover Sheet
                SetHelper(portfolio, 12, dHeight, dWidth, margins);
                if (this.Strategy.isCoverSheetIncluded)
                {
                    WriteCoverSheet();
                }

                // Write Main Content RFA, Grant, etc.  
                foreach (var application in helper.Portfolio.Applications)
                {
                    if (application.IsSelectedForPrint)
                    {
                        switch (helper.CurrentApplication.GetType().ToString())
                        {
                            case "CMWModels.CMWRfa":
                                var rfa = (CMWRfa)helper.CurrentApplication;
                                WriteRfa(rfa);
                                WriteRfaIncludeSummary(rfa);
                                break;

                            default:
                                var grant = (CMWGrant)helper.CurrentApplication;
                                WriteGrant(grant);
                                WriteIncludeSummary(grant, writer.PageNumber);
                                break;
                        }
                    }
                    helper.NextApplication();
                }


                // Write Attachments
                if (this.Strategy.isAttachmentIncluded)
                {
                    foreach (var application in helper.Portfolio.Applications)
                    {
                        if (application.IsSelectedForPrint)
                        {
                            if( application is CMWRfa)
                                WriteAttachmentsRFA((CMWRfa)application,writer.PageNumber);

                            if (application is CMWGrant)
                                WriteAttachmentsGrant((CMWGrant)application, writer.PageNumber);
                        }
                    }
                }

                document.Close();
                return output;
            }
        }
Exemplo n.º 2
0
        private void SetHelper(CMWCouncilActionsPortfolio portfolio, float fontsize, float height, float width, float[] margins)
        {
            helper = new PDFHelper(portfolio, fontsize, height, width, margins);
            helper.PageEndReached += helper_PageEndReached;
            helper.PageEnd += helper_PageEnd;
            // page handlers

            writer.PageEvent = helper;
            // add events
        }
Exemplo n.º 3
0
        public MemoryStream CreateListFundingApplications(CMWCouncilActionsPortfolio portfolio)
        {

            using (MemoryStream output = new MemoryStream())
            {
                if (portfolio.Groups.Count < 1)
                    return output;

                float[] margins = { MarginLeft.ToPts(), MarginRight.ToPts(), MarginTop.ToPts(), MarginBottom.ToPts() };
                document = new it.Document(it.PageSize.LEGAL_LANDSCAPE.Rotate(), margins[0], margins[1], margins[2], margins[3]);
                writer = PdfWriter.GetInstance(document, output);
                // writer listens to changes in doc & associate doc to output stream

                writer.SetTagged();
                writer.Tabs = PdfName.S;
                // enable marked content
                SetMetaDataTitle(Strategy, portfolio.Applications);
                SetMetaData(output);
                // set metadata   

                document.Open();
                // open the document 

                float dHeight = document.PageSize.Height;
                float dWidth = document.PageSize.Width;

                var treeRoot = writer.StructureTreeRoot;
                content = writer.DirectContent;
                under = writer.DirectContentUnder;

                // Main Tag
                root = new PdfStructureElement(treeRoot, new PdfName("Document"));
                content.BeginMarkedContentSequence(root);
                content.EndMarkedContentSequence();
                int total = writer.PageNumber;

                // Write Cover Sheet
                SetHelper(portfolio, 12, dHeight, dWidth, margins);

                WriteFDApplication();


                document.Close();
                return output;
            }
        }
Exemplo n.º 4
0
 public void GenItemsList(CMWCouncilActionsPortfolio Portfolio)
 {
     CouncilMeetingDate = Portfolio.CouncilMeetingDate;
     Create(Portfolio.Applications);
 }
Exemplo n.º 5
0
 public CoverSheet(CMWCouncilActionsPortfolio Portfolio)
 {
     GenItemsList(Portfolio);
 }
Exemplo n.º 6
0
        public static CMWCouncilActionsPortfolio GetPortfolio(){

            var Portfolio = new CMWCouncilActionsPortfolio();
            Portfolio.Applications.Add(CMWPDFData.Populate("")); // grant
            Portfolio.Applications.Add(CMWPDFData.Populate("m"));// grant merit
            Portfolio.Applications.Add(CMWPDFData.PopulateRFA_IDDB());
            Portfolio.CouncilMeetingDate = DateTime.Now.Date.Year.ToString() + DateTime.Now.Date.Month.ToString() + DateTime.Now.Date.Day.ToString();
            return Portfolio;
        }