public override void Print(Document document, Stream printStream) { var pdf = new PdfDocument(); foreach (var font in document.Fonts) { var pdfFont = pdf.CreateFont(PdfFontTypes.TYPE1, font.FontName); if (font.IsDefault) { defaultFont = pdfFont.FontName; } } foreach (Image image in document.Images) { var wi = new WinImage(image.url); var pdfImage = pdf.CreateImage(wi); image.ImageName.Name = pdfImage.Name; } foreach (var page in document.Pages) { PrintPage(page, pdf); } pdf.Print(printStream); printStream.Flush(); }
public void Generate() { IDbConnection cn = new MySqlConnection("Server=localhost;Database=world;User ID=testuser;Password=password;"); var generator = new Generator(report) {Connection = cn}; document = generator.FillReport(); }
public void Print(Document document, AbstractDriver printerDriver, Stream stream) { printerDriver.Print(document, stream); }
public abstract void Print(Document document, Stream printStream);
public override void Print(Document document, Stream printStream) { throw new System.NotImplementedException(); }
private Document BuildDocument() { calculator.Init(); var document = new Document { Fonts = report.Fonts, Images = new Image[report.ImageCollection.Count], Height = report.Height, Width = report.Width }; report.ImageCollection.Values.CopyTo(document.Images, 0); var page = openPage(document); var RECORD_COUNT = 0; var PAGE_NUMBER = 1; calculator.SetField("PageNumber", PAGE_NUMBER); var dataReader = GetDataReader(); while (dataReader.Read()) { RECORD_COUNT++; calculator.UpdateFields(report.Fields, dataReader); calculator.EvaluateExpressions(report.Expressions); calculator.SetField("GlobalRecordCount", RECORD_COUNT); appendGroupFooters(page, report.Groups); appendGroupHeaders(page); foreach (var band in report.Detail.Bands) { if (pageBreak()) { appendPageFooter(page); page = openPage(document); calculator.SetField("PageNumber", PAGE_NUMBER++); } appendBand(page, band); } } appendPageFooter(page); return document; }
private Page openPage(Document document) { var page = document.CreatePage(); resetH(); appendPageHeader(page); return page; }