本文整理汇总了C#中Cairo.Context.ShowPage方法的典型用法代码示例。如果您正苦于以下问题:C# Context.ShowPage方法的具体用法?C# Context.ShowPage怎么用?C# Context.ShowPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Context.ShowPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportToPdf
public static void ExportToPdf(this Report report ,string path)
{
using (PdfSurface pdfSurface = new PdfSurface (
path,report.WidthWithMargins,report.HeightWithMargins)) {
Cairo.Context cr = new Cairo.Context (pdfSurface);
cr.Translate(report.Margin.Left,report.Margin.Top);
ReportRenderer renderer = new ReportRenderer (){ Context = cr};
renderer.RegisterRenderer (typeof(TextBlock), new TextBlockRenderer ());
renderer.RegisterRenderer (typeof(Line), new LineRenderer ());
renderer.RegisterRenderer (typeof(Image), new ImageRenderer (){ PixbufRepository = new PixbufRepository(report.ResourceRepository)});
SectionRenderer sr = new SectionRenderer();
renderer.RegisterRenderer(typeof(ReportHeaderSection), sr);
renderer.RegisterRenderer(typeof(ReportFooterSection), sr);
renderer.RegisterRenderer(typeof(DetailSection), sr);
renderer.RegisterRenderer(typeof(PageHeaderSection), sr);
renderer.RegisterRenderer(typeof(PageFooterSection), sr);
MonoReports.Model.Engine.ReportEngine engine = new MonoReports.Model.Engine.ReportEngine (report,renderer);
engine.Process ();
for (int i = 0; i < report.Pages.Count; ++i) {
renderer.RenderPage (report.Pages [i]);
cr.ShowPage ();
}
pdfSurface.Finish ();
(cr as IDisposable).Dispose ();
}
}
示例2: Write
public static void Write(string fileName)
{
Diagram diagram = Program.Load(fileName);
string pdfName = System.IO.Path.ChangeExtension(fileName, "pdf");
if(diagram != null)
{
try
{
using(PdfSurface pdfs = new PdfSurface(pdfName, 595, 842))
{
using(Context cr = new Context(pdfs))
{
DiagramRenderer dr = new DiagramRenderer(cr, 0, 0, diagram);
cr.LineWidth = 1.0;
cr.Color = new Color(0.0, 0.0, 0.0);
dr.Render();
pdfs.SetSize(dr.width, dr.height);
dr.Draw();
cr.ShowPage();
}
}
Console.WriteLine("Wrote {0}", pdfName);
}
catch
{
Console.WriteLine("Error writing {0}", pdfName);
}
}
}
示例3: Main
public static void Main(string[] args)
{
// call the snippets
Snippets snip = new Snippets();
Surface surface = new PSSurface("snippets.ps", IMAGE_WIDTH, IMAGE_WIDTH);
Context cr = new Context(surface);
foreach (string snippet in Snippets.snippets)
{
cr.Save();
Snippets.InvokeSnippet(snip, snippet, cr, IMAGE_WIDTH, IMAGE_HEIGHT);
cr.ShowPage();
cr.Restore();
}
surface.Finish ();
}
示例4: Main
public static void Main(string[] args)
{
// call the snippets
Snippets snip = new Snippets();
foreach (string snippet in Snippets.snippets)
{
string filename = "./" + snippet + ".svg";
Surface surface = new SvgSurface(filename, IMAGE_WIDTH, IMAGE_WIDTH);
Context cr = new Context(surface);
cr.Save();
Snippets.InvokeSnippet(snip, snippet, cr, IMAGE_WIDTH, IMAGE_HEIGHT);
cr.ShowPage();
cr.Restore();
surface.Finish ();
}
}