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 SetIncludeOnlySection(ONNotebook notebook)
        {
            if (notebook == null)
            {
                throw new ArgumentNullException("notebook");
            }

            ONSection section = notebook.GetSection(Config.Current.ExportOnly);

            if (section == null)
            {
                // dont find any section to process
                return;
            }
            notebook.SetNotebookExcludeFlag(true);
            notebook.SetSectionExcludeFlag(section, false);

            // propagate settings
            ONBasedType b = section;

            while (b != notebook)
            {
                if (b is ONSection)
                {
                    (b as ONSection).Exclude = false;
                }
                b = b.Parent;
            }

            Log.Information(string.Format("Export only section [{0}]", section.Name));
            //foreach
        }
Exemplo n.º 3
0
        public void PDFExportSectionTest()
        {
            Export2PDF_Accessor target = new Export2PDF_Accessor(); // TODO: Initialize to an appropriate value
            string    basedName        = string.Empty;              // TODO: Initialize to an appropriate value
            ONSection section          = null;                      // TODO: Initialize to an appropriate value

            target.PDFExportSection(basedName, section);
        }
Exemplo n.º 4
0
        public void PDFCombineSectionTest()
        {
            Export2PDF_Accessor target  = new Export2PDF_Accessor();
            PdfOutline          parent  = null;
            ONSection           section = null;

            target.PDFCombineSection(parent, section);
        }
Exemplo n.º 5
0
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for PDFMergeAll
        ///</summary>
        public void PDFMergeAllTestHelper <T>()
        {
            Export2PDF_Accessor target = new Export2PDF_Accessor(); // TODO: Initialize to an appropriate value
            string    basedName        = string.Empty;              // TODO: Initialize to an appropriate value
            ONSection sec = null;                                   // TODO: Initialize to an appropriate value

            target.PDFMergeAll(basedName, sec);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Exemplo n.º 6
0
        public void GetSectionTest1()
        {
            ONNotebook target      = notebookListing.GetNotebook("Shared Reference");
            string     sectionName = "learning/programing";
            ONSection  expected    = null;
            ONSection  actual;

            actual = target.GetSection(sectionName);
            Assert.AreEqual(expected, actual);
        }