示例#1
0
        static void Main(string[] args)
        {
            // Convert HTML file/url to PDF file.
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();
            //v.Serial = "XXXXXXXXXXXXXXX";

            // Set "Edge mode" to support all modern CSS.
            SautinSoft.PdfVision.TrySetBrowserModeEdgeInRegistry();

            string   inpUrl  = @"https://www.sautinsoft.com/products/pdf-vision/index.php";
            FileInfo outFile = new FileInfo(@"Result.pdf");

            int ret = v.ConvertHtmlFileToPDFFile(inpUrl, outFile.FullName);

            // 0 - converting successfully
            // 1 - can't open input file, check the input path
            // 2 - can't create output file, check the output path
            // 3 - converting failed
            if (ret == 0)
            {
                // Open the resulting PDF document in a default PDF Viewer.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile.FullName)
                {
                    UseShellExecute = true
                });
            }
        }
示例#2
0
    public void htmltopdf()
    {
        SautinSoft.PdfVision v = new SautinSoft.PdfVision();
        v.ConvertHtmlFileToPDFFile(@"http://stackoverflow.com/questions/3270417/how-to-save-current-aspx-page-as-html", @"E:\ppdf\a.pdf");
        Document doc = new Document();
        //PdfWriter.GetInstance(doc, new FileStream(@"E:\ppdf\a.pdf", System.IO.FileMode.Create));
        //HtmlParser.Parse(doc, @"E:\ppdf\a.html");
        ////XmlParser.Parse(doc, Server.MapPath("image\\test.xml"));
        ////ITextHandler h = new ITextHandler(doc, new TagMap("c:\\test.xml"));
        ////h.Parse("c:\\test.xml");

        //if (File.Exists(@"E:\ppdf\a.html"))
        //    File.Delete(@"E:\ppdf\a.html");
        //if (File.Exists(@"E:\ppdf\a.html"))
        //    File.Delete(@"E:\ppdf\a.html");
    }
示例#3
0
        static void Main(string[] args)
        {
            // Convert ASPX page to PDF file.
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();

            // Set "Edge mode" to support all modern CSS.
            SautinSoft.PdfVision.TrySetBrowserModeEdgeInRegistry();

            //v.Serial = "XXXXXXXXXXXXXXX";

            // Specify some options.
            v.PageStyle.PageSize.Letter();
            v.PageStyle.PageOrientation.Landscape();
            v.PageStyle.PageNumbers.PageNumbersInBottom = "Page {page} of {numpages}";
            v.PageStyle.PageNumbers.Aligment.Right();
            v.PageStyle.PageNumbers.FontSize = 16;
            v.PageStyle.PageNumbers.FontColor.SetRGB(30, 30, 30);
            v.PageStyle.PageNumbers.MarginFromStart.Mm(20);

            //v.PageStyle.PageMarginLeft.Inch(1);
            //v.ImageStyle.Heightmm(150);
            //v.ImageStyle.WidthInch(10);

            // Convert ASPX page to PDF file.
            string   inpUrl  = @"https://www.sautinsoft.net/default.aspx";
            FileInfo outFile = new FileInfo("Result.pdf");

            int ret = v.ConvertHtmlFileToPDFFile(inpUrl, outFile.FullName);

            // 0 - converting successfully.
            // 1 - can't open input file, check the input path.
            // 2 - can't create output file, check the output path.
            // 3 - converting failed.
            if (ret == 0)
            {
                // Open the resulting PDF document in a default PDF Viewer.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile.FullName)
                {
                    UseShellExecute = true
                });
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            // Convert HTML file/url to PDF file.
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();

            //v.Serial = "XXXXXXXXXXXXXXX";

            // Specify the conversion options.
            v.PageStyle.PageSize.Auto();
            //v.PageStyle.PageMarginLeft.Inch(1);
            //v.ImageStyle.Heightmm(150);
            //v.ImageStyle.WidthInch(10);

            // Specify top and bottom page margins.
            //v.PageStyle.PageMarginTop.Mm(5f);
            //v.PageStyle.PageMarginBottom.Mm(5f);

            SautinSoft.PdfVision.TrySetBrowserModeEdgeInRegistry();

            string   inpUrl  = @"https://nationalzoo.si.edu/";
            FileInfo outFile = new FileInfo(@"Result.pdf");

            int ret = v.ConvertHtmlFileToPDFFile(inpUrl, outFile.FullName);

            // 0 - converting successfully
            // 1 - can't open input file, check the input path
            // 2 - can't create output file, check the output path
            // 3 - converting failed
            if (ret == 0)
            {
                // Open the resulting PDF document in a default PDF Viewer.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile.FullName)
                {
                    UseShellExecute = true
                });
            }
        }
示例#5
0
 public void mostrar_reporte_tokens()
 {
     Process.Start("Tokens.html");
     SautinSoft.PdfVision v = new SautinSoft.PdfVision();
     v.ConvertHtmlFileToPDFFile(@"C:/Users/marco/Documents/GitHub/PROYECTO1_OLC1/Proyecto1_201700328/Proyecto1_201700328/bin/Debug/Tokens.html", @"C:/Users/marco/Documents/GitHub/PROYECTO1_OLC1/Proyecto1_201700328/Proyecto1_201700328/bin/Debug/salida.pdf");
 }