public void DrawPage(object o, DrawPageArgs args) { var g = args.Context.CairoContext; RenderCairo render = new RenderCairo(g); render.RunPage(Pages[args.PageNr]); }
static void PrintOperation_DrawPage(object o, DrawPageArgs args) { using (PrintContext context = args.Context) { using (var pixBuf = currentImage.GetPixbuf()) { Cairo.Context cr = context.CairoContext; double scale = 1; if (pixBuf.Height * context.Width / pixBuf.Width <= context.Height) { scale = context.Width / pixBuf.Width; } if (pixBuf.Width * context.Height / pixBuf.Height <= context.Width) { scale = context.Height / pixBuf.Height; } cr.Scale(scale, scale); cr.MoveTo(0, 0); CairoHelper.SetSourcePixbuf(cr, pixBuf, 0, 0); cr.Paint(); ((IDisposable)cr).Dispose(); } } }
void HandlePrintDrawPage(object o, DrawPageArgs args) { Cairo.Context g = args.Context.CairoContext; RenderCairo render = new RenderCairo(g); render.RunPage(pages[args.PageNr]); }
private void HandlePrintDrawPage(object o, DrawPageArgs args) { using (var context = args.Context.CairoContext) { var render = new RenderCairo(context); render.RunPage(_pages[args.PageNr]); } }
private void document_DrawPage(object sender, DrawPageArgs args) { TotalPages = document.TotalPages; ComputeAdjustments(); QueueDraw(); OnPagesCalculated(EventArgs.Empty); }
void HandlePrintDrawPage(object o, DrawPageArgs args) { Cairo.Context g = args.Context.CairoContext; g.Translate(report.LeftMarginPoints, 0); //FIXME Perhaps need add top margin RenderCairo render = new RenderCairo(g); render.RunPage(pages[args.PageNr]); }
public void DrawPage(object o, DrawPageArgs args) { var g = args.Context.CairoContext; int pageNumber, reportNumber; CalculateDocPage(args.PageNr, out reportNumber, out pageNumber); RenderCairo render = new RenderCairo(g); render.RunPage(reportPages[reportNumber][pageNumber]); }
void operation_DrawPage(object o, DrawPageArgs args) { if (dialog != null) { dialog.Total = operation.TotalPages; dialog.Current = args.PageNr + 1; } if (dialog != null && dialog.Cancelled) { operation.Cancelled = true; } }
void HandleDrawPage(object o, DrawPageArgs args) { var doc = PintaCore.Workspace.ActiveDocument; // TODO - support scaling to fit page, centering image, etc. using (var surface = doc.GetFlattenedImage()) { using (var context = args.Context.CairoContext) { context.SetSourceSurface(surface, 0, 0); context.Paint(); } } }
// public void BeginPrint(object o, BeginPrintArgs args) // { // Console.WriteLine("BeginPrint"); // } public void DrawPage(object o, DrawPageArgs args) { Console.WriteLine("DrawPage"); Pango.Layout layout; int textWidth, textHeight; double width; FontDescription desc; Cairo.Context con = args.Context.CairoContext; width = args.Context.Width; // Rectangle con.Rectangle(0, 0, width, HEADER_HEIGHT); con.Color = new Cairo.Color(1, 0.2, 0.2, 0.6); con.FillPreserve(); // Draw another thing con.Color = new Cairo.Color(0, 0, 0); con.LineWidth = 1; con.Stroke(); con.Color = new Cairo.Color(0, 0, 0); con.MoveTo(20, 200); con.CurveTo(40, 270, 120, 165, 70, 60); con.Stroke(); con.MoveTo(30, 100); con.LineTo(60, 80); con.Stroke(); con.Color = new Cairo.Color(0, 0, 0); layout = args.Context.CreatePangoLayout(); layout.SetText("Prueba con Pango"); desc = FontDescription.FromString("arial 14"); layout.FontDescription = desc; layout.GetPixelSize(out textWidth, out textHeight); if (textWidth > width) { layout.Width = (int)width; layout.Ellipsize = EllipsizeMode.Start; layout.GetPixelSize(out textWidth, out textHeight); } con.MoveTo((width - textWidth) / 2, (HEADER_HEIGHT - textHeight) / 2); Pango.CairoHelper.ShowLayout(con, layout); }
private void DrawPage(object o, DrawPageArgs args) { /* Print shapes in the ReporteHeader section if we are drawing * the first page */ // if (args.PageNr == 0) { // Console.WriteLine("$$$$$$$$$$$$$$ REPORT HEADER"); // this.reportHeader.Draw(args.Context, // this.data, // this.dataTables, // Double.MaxValue); // } // Print shapes in the PageHeader section Console.WriteLine("$$$$$$$$$$$$$$ Page Header"); this.pageHeader.Draw(args.Context, this.data, this.dataTables, this.svgDocument.PageDetailSection.Y, true); // Print shapes in the PageDetail section Console.WriteLine("$$$$$$$$$$$$$$ Page Detail"); this.pageDetail.Draw(args.Context, this.data, this.dataTables, this.svgDocument.PageFooterSection.Y, true); // Print shapes in the PageFooter section Console.WriteLine("$$$$$$$$$$$$$$ Page Footer"); this.pageFooter.Draw(args.Context, this.data, this.dataTables, this.printOperation.PrintSettings.PaperSize.GetHeight(Unit.Mm), true); /* Print shapes in the ReportFooter section if we are draing the * last page (TODO) */ }
void HandleM_printDrawPage(object o, DrawPageArgs args) { // Create a Print Context from the Print Operation PrintContext context = args.Context; // Create a Cairo Context from the Print Context Cairo.Context cr = context.CairoContext; // Get the width of the Print Context double width = context.Width; // Create a rectangle to be used for the Content cr.Rectangle(0, 0, width, headerHeight); cr.SetSourceRGB(0.95, 0.95, 0.95); cr.FillPreserve(); // Create a Stroke to outline the Content cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 1; cr.Stroke(); // Create a Pango Layout for the Text Pango.Layout layout = context.CreatePangoLayout(); // Get the Text Height fromt the Height of the layout and the Height of the Page int layoutWidth, layoutHeight; layout.GetSize(out layoutWidth, out layoutHeight); double textHeight = (double)layoutHeight / (double)pangoScale; cr.MoveTo(5, (headerHeight - textHeight) / 2); // Set the Font and Font Size desired Pango.FontDescription desc = Pango.FontDescription.FromString("sans 12"); layout.FontDescription = desc; // Create a Header with the FileName and center it on the page layout.SetText(m_cache.Name + " : " + m_cache.CacheName); //layout.Width = (int) width *3; layout.Alignment = Pango.Alignment.Left; Pango.CairoHelper.ShowLayout(cr, layout); // cr.MoveTo (width/2, (headerHeight - textHeight) / 2); // Set the Page Number in the Footer with a right alignment string pageStr = String.Format(Catalog.GetString("Page {0} of {1}"), args.PageNr + 1, m_numPages); layout.SetText(pageStr); layout.Alignment = Pango.Alignment.Right; cr.MoveTo(width - 75, (headerHeight - textHeight) / 2); Pango.CairoHelper.ShowLayout(cr, layout); // Create a new Pango Layout for the Content layout = null; layout = context.CreatePangoLayout(); // Set the Description of the Content desc = Pango.FontDescription.FromString("sans"); desc.Size = (int)(m_fontSize * pangoScale); layout.FontDescription = desc; // Move to the beginning of the Content, which is after the Header Height and Gap cr.MoveTo(0, headerHeight + headerGap); int line = args.PageNr * m_linesPerPage; // Draw the lines on the page according to how many lines there are left and how many lines can fit on the page for (int i = 0; i < m_linesPerPage && line < m_numLines; i++) { layout.SetMarkup(m_Lines[line].TrimStart()); Pango.CairoHelper.ShowLayout(cr, layout); cr.RelMoveTo(0, m_fontSize + 0.5); line++; } layout = null; context.Dispose(); }