コード例 #1
0
 public ActionResult SaveDocument(PDocument pcontent)
 {
     // do something
     return(new JsonResult()
     {
         Data = new { Success = true }
     });
 }
コード例 #2
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Html2Pdf.Console Started.");
            System.Console.WriteLine("");

            string htmlFile = String.Empty;
            string pdfFile  = String.Empty;

            if (args.Length == 0)
            {
                htmlFile = GetDataDir() + "test.html";
                //htmlFile = GetDataDir() + "test1.html";
                //htmlFile = GetDataDir() + "test2.html";
            }

            if (args.Length > 0)
            {
                htmlFile = GetDataDir() + args[0];
            }

            if (args.Length > 1)
            {
                pdfFile = GetDataDir() + args[1];
            }
            else
            {
                pdfFile = htmlFile.Replace(".html", ".pdf");
            }

            System.Console.WriteLine("Html file: " + htmlFile);
            System.Console.WriteLine("Pdf file: " + pdfFile);
            System.Console.WriteLine("");

            try
            {
                var hDocument = new HDocument(htmlFile);
                var pDocument = new PDocument(pdfFile, hDocument);

                //DEBUG
                //System.Console.Write(hDocument);
                //System.Console.WriteLine("");

                System.Console.WriteLine("PDF File was Created (" + pdfFile + ")");
            }
            catch (H2PException e)
            {
                System.Console.WriteLine("H2P Exception! code: " + e.Code + ", message: " + e.Message);
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Exception! message: " + e.Message);
            }

            System.Console.WriteLine("\r\n\r\nProgram Finished. Press any key to exit . . .");
            System.Console.ReadKey();
        }
コード例 #3
0
ファイル: prods.cs プロジェクト: JamesJustinHarrell/niviok
        internal override void RemoveChild(Node child)
        {
            if(_base_ == child)
            {
            _base_ = null;
            return;
            }

            if(_eof_ == child)
            {
            _eof_ = null;
            return;
            }
        }
コード例 #4
0
ファイル: prods.cs プロジェクト: JamesJustinHarrell/niviok
        public void SetPDocument(PDocument node)
        {
            if(_base_ != null)
            {
            _base_.Parent(null);
            }

            if(node != null)
            {
            if(node.Parent() != null)
            {
                node.Parent().RemoveChild(node);
            }

            node.Parent(this);
            }

            _base_ = node;
        }
コード例 #5
0
ファイル: prods.cs プロジェクト: JamesJustinHarrell/niviok
 public Start(
 PDocument _base_,
 EOF _eof_)
 {
     SetPDocument(_base_);
     SetEOF(_eof_);
 }