示例#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();
        }
示例#2
0
 public void WritePostscript(Stream output, bool closestream = true)
 {
     using (CairoPostscriptSurface surface = new CairoPostscriptSurface(output, 620, 877, closestream))
     {
         using (Cairo cairo = new Cairo(surface))
         {
             foreach (PopplerPage page in this)
             {
                 surface.SetSize(page.WidthInPoints, page.HeightinPoints);
                 cairo.Save();
                 page.RenderForPrinting(cairo);
                 cairo.Restore();
                 surface.ShowPage();
             }
         }
     }
 }