Beispiel #1
0
        public void CreatePdf(IEnumerable <int> articleRevueIds, Stream memoryStream)
        {
            var articlesRevues = _uow.ArticlesRevue.Get(b => articleRevueIds.Contains(b.Id),
                                                        o => o.OrderBy(ar => ar.PeriodePublication).ThenBy(ar => ar.NumeroRevue.HasValue ? ar.NumeroRevue.Value : 0).ThenBy(ar => ar.PremierePage),
                                                        b => b.Revue.RevueMere);

            var pdfManager        = _pdfManager.Create(memoryStream);
            PdfTableOfContent toc = new PdfTableOfContent("Sommaire");
            var totalPage         = 0;

            foreach (var articleRevue in articlesRevues)
            {
                toc.AddContent(String.Format("{0} ({1})", articleRevue.Titre, articleRevue.ShortTag), totalPage + 1);

                var documentToMerge = articleRevue.GetDocuments();
                foreach (var doc in documentToMerge)
                {
                    totalPage += pdfManager.AddPdf(doc.NomCompletFichier, doc.Tag, _fileMissingMessage, articleRevue.PagesReferences.ListePages.ToList(), true);
                }
            }

            toc.DecalePage(pdfManager.ComputeTableOfContent(toc));
            pdfManager.AddTableOfContent(toc);
            pdfManager.Close();
        }
Beispiel #2
0
        public void CreatePdf(IEnumerable <int> acteIds, Stream memoryStream)
        {
            var actes = _uow.Actes.Get(b => acteIds.Contains(b.Id), null,
                                       b => b.ParoisseRegistre).OrderByExtList <Acte, int>(acteIds.ToList(), b => b.Id);

            var pdfManager        = _pdfManager.Create(memoryStream);
            PdfTableOfContent toc = new PdfTableOfContent("Sommaire");
            var totalPage         = 0;

            foreach (var acte in actes)
            {
                toc.AddContent(String.Format("{0} ({1})", acte.ShortTag, acte.RegistreParoissial), totalPage + 1);

                var documentToMerge = acte.GetDocuments();

                foreach (var doc in documentToMerge)
                {
                    totalPage += pdfManager.AddPdf(doc.NomCompletFichier, doc.Tag, _fileMissingMessage, acte.PagesReferences.ListePages.ToList());
                }
            }

            toc.DecalePage(pdfManager.ComputeTableOfContent(toc));
            pdfManager.AddTableOfContent(toc);
            pdfManager.Close();
        }
Beispiel #3
0
        public void CreatePdf(IEnumerable <int> pretreIds, Stream memoryStream)
        {
            var pretres = _uow.Pretres.Get(b => pretreIds.Contains(b.Id), null,
                                           b => b.Documents,
                                           b => b.Photos,
                                           b => b.ArticlesRevue.Select(ar => ar.Revue),
                                           b => b.FonctionsLieu.Select(fl => fl.Fonction),
                                           b => b.FonctionsLieu.Select(fl => fl.Lieu.TypeLieu)).OrderByExtList <Pretre, int>(pretreIds.ToList(), b => b.Id);

            var pdfManager        = _pdfManager.Create(memoryStream);
            PdfTableOfContent toc = new PdfTableOfContent("Sommaire");
            var totalPage         = 0;

            foreach (var pretre in pretres)
            {
                toc.AddContent(pretre.NomComplet, totalPage + 1);
                totalPage += WritePretreToPdf(pdfManager, pretre);
            }

            toc.DecalePage(pdfManager.ComputeTableOfContent(toc));
            pdfManager.AddTableOfContent(toc);
            pdfManager.Close();
        }