Esempio n. 1
0
        public void Print(GDIPrinterDeviceContext dc, string jobname)
        {
            dc.StartDoc(jobname);

            using (CairoWin32PrintingSurface surface = new CairoWin32PrintingSurface(dc))
            {
                using (Cairo cairo = new Cairo(surface))
                {
                    int xdpi = dc.PrintTicket.PageResolution.X ?? 75;
                    int ydpi = dc.PrintTicket.PageResolution.Y ?? 75;

                    cairo.Scale(xdpi / 72.0, ydpi / 72.0);

                    foreach (PopplerPage page in this)
                    {
                        dc.StartPage();

                        cairo.Save();
                        page.RenderForPrinting(cairo);
                        cairo.Restore();
                        surface.ShowPage();


                        dc.EndPage();
                    }
                }

                surface.Finish();
            }

            dc.EndDoc();
        }
Esempio n. 2
0
 public CairoWin32PrintingSurface(GDIPrinterDeviceContext dc)
 {
     this.CairoSurfacePtr = NativeMethods.cairo_win32_printing_surface_create(dc.HDC);
 }