Ejemplo n.º 1
0
        public void DataTableBuilderTimer999Test()
        {
            CodeTimer.Time("ListBuilderTimer999Test", ConstValue.Times999, () =>
            {
                var fs = new MemoryStream();
                PDFBuilder pdfBuilder = new PDFBuilder(fs);
                pdfBuilder.Failure += (x, y) => { Console.WriteLine(y.Error); };
                pdfBuilder.DocumentInfo = new DocumentInfo() { Author = "dason", Title = "title" };

                pdfBuilder.Add(new TableElement(new ElementPosition(20, 150), dt)
                {
                    Heads = new[]
               {
                   new TableHeadElement(){BindName = "stR1",DisplayName = "中文【str】",Width = 120},
                   new TableHeadElement(){BindName = "str2",DisplayName = "中文【str2】",Width = 150},
               },
                    FillRows = true,
                    FillPage = true,
                    NextPageMarginPosition = true,
                });
                pdfBuilder.Start();
            }
            );
        }
Ejemplo n.º 2
0
 public PDFTableBuilder(PDFBuilder pdfBuilder, TableElement table1)
 {
     _pdfBuilder = pdfBuilder;
     this.table = table1;
 }
Ejemplo n.º 3
0
 public void PDFBuilderTest()
 {
     var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     var path = Path.Combine(desktop, DateTime.Now.ToString("yyyyMMdd") + ".pdf");
     var tmppath = Path.Combine(desktop, "tmp.pdf");
     FileStream fs = new FileStream(path, FileMode.Create);
     // var fs = new MemoryStream();
     PDFBuilder pdfBuilder = new PDFBuilder(fs);
     pdfBuilder.Failure += (x, y) => { Console.WriteLine(y.Error); };
     pdfBuilder.DocumentInfo = new DocumentInfo() { Author = "dason", Title = "title" };
     if (File.Exists(tmppath)) pdfBuilder.SetTemplate(tmppath);
     pdfBuilder.Add(new LineElement(new ElementPosition(20, 50), 400, 5) { Color = new RGBColor(5, 99, 10) });
     pdfBuilder.Add(new RectangleElement(new ElementPosition(100, 90), new ElementSize(100, 200)) { Border = 10, Color = new RGBColor(205, 199, 100) });
     pdfBuilder.Add(new LineElement(new ElementPosition(103, 90), 100, 2));
     pdfBuilder.Add(new TableElement(new ElementPosition(20, 150), dt)
     {
         Heads = new[]
        {
            new TableHeadElement(){BindName = "stR1",DisplayName = "中文【str】",Width = 120},
            new TableHeadElement(){BindName = "str2",DisplayName = "中文【str2】",Width = 150},
        },
         FillRows = true,
         //  FillRowCounts = 100,
         FillPage = true,
         NextPageMarginPosition = true,
     });
     pdfBuilder.Start();
 }