Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var gc = new Pechkin.GlobalConfig();
            var pechkin = new Pechkin.Synchronized.SynchronizedPechkin(gc);

            byte[] pdf = pechkin.Convert(new Uri("http://www.google.com"));

            System.IO.File.WriteAllBytes(@"C:\temp\test.pdf", pdf);    
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var gc      = new Pechkin.GlobalConfig();
            var pechkin = new Pechkin.Synchronized.SynchronizedPechkin(gc);

            byte[] pdf = pechkin.Convert(new Uri("http://www.google.com"));

            System.IO.File.WriteAllBytes(@"C:\temp\test.pdf", pdf);
        }
Beispiel #3
0
        public static byte[] CreatePdfFromHtml(string exportHtml, string linkedResourcePath = null)
        {
            if (string.IsNullOrEmpty(linkedResourcePath))
            {
                linkedResourcePath = ConfigurationManager.AppSettings["linkedResourcePath"];
            }
            exportHtml = exportHtml.Replace("src=\".", "src=\"" + linkedResourcePath);
            byte[] pdf = new Pechkin.Synchronized.SynchronizedPechkin(
                new Pechkin.GlobalConfig()
                .SetPaperSize(PaperKind.A4))
                         .Convert(new Pechkin.ObjectConfig()
                                  .SetLoadImages(true)
                                  .SetZoomFactor(1.2)
                                  .SetPrintBackground(true)
                                  .SetScreenMediaType(true)
                                  .SetCreateExternalLinks(true), exportHtml);

            return(pdf);
        }