Exemplo n.º 1
0
        private void PDFMergeAll(string basedName, ONSection sec)
        {
            if (sec == null)
            {
                throw new ArgumentNullException("sec");
            }
            if (sec.Exclude)
            {
                Log.Warning("Trying to export the excluding section. Abort!");
                return;
            }

            if (!InitDocument(Path.Combine(basedName, sec.Name) + ".pdf"))
            {
                return;
            }
            TOCHandler.Init(pdfDocument, pdfWriter);

            TOCHandler.BeginTocEntry();
            PDFCombineSection(pdfWriter.DirectContent.RootOutline, sec);
            TOCHandler.EndTocEntry();

            TOCHandler.WriteTocEntries();
            TOCHandler.Close();
            CloseDocument();
        }
Exemplo n.º 2
0
        private void PDFCombineAll(string basedName, Data.ONNotebook notebook)
        {
            if (notebook == null)
            {
                throw new ArgumentNullException("notebook");
            }

            if (!InitDocument(Path.Combine(basedName, notebook.Name) + ".pdf"))
            {
                return;
            }

            TOCHandler.Init(pdfDocument, pdfWriter);

            PdfOutline root = pdfWriter.DirectContent.RootOutline;

            TOCHandler.BeginTocEntry();
            foreach (Data.ONSection section in notebook.Sections)
            {
                if (!section.Exclude)
                {
                    TOCHandler.AddTocEntry(section.Name, pdfWriter.CurrentPageNumber);
                    TOCHandler.BeginTocEntry();
                    PDFCombineSection(root, section);
                    TOCHandler.EndTocEntry();
                }
            }
            TOCHandler.EndTocEntry();

            TOCHandler.WriteTocEntries();
            TOCHandler.Close();
            CloseDocument();
        }