Пример #1
0
        public Poppler.Page GetPage(int index)
        {
            IntPtr raw_ret = poppler_document_get_page(Handle, index);

            Poppler.Page ret = GLib.Object.GetObject(raw_ret) as Poppler.Page;
            return(ret);
        }
Пример #2
0
        public Poppler.Page GetPageByLabel(string label)
        {
            IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup(label);
            IntPtr raw_ret      = poppler_document_get_page_by_label(Handle, native_label);

            Poppler.Page ret = GLib.Object.GetObject(raw_ret) as Poppler.Page;
            GLib.Marshaller.Free(native_label);
            return(ret);
        }
Пример #3
0
        /// <summary>
        /// OnDrawPage - Draws the Content of each Page to be printed
        /// </summary>
        /// <param name="obj">The Print Operation</param>
        /// <param name="args">The DrawPageArgs passed by the Print Operation</param>
        private void OnDrawPage(object obj, Gtk.DrawPageArgs args)
        {
            // Create a Print Context from the Print Operation
            Gtk.PrintContext context = args.Context;

            // Create a Cairo Context from the Print Context
            Cairo.Context cr = context.CairoContext;

            Poppler.Page pg = this.pdf.GetPage(args.PageNr);
            pg.RenderForPrintingWithOptions(cr, Poppler.PrintFlags.Document);
        }
Пример #4
0
        private void RenderPage(ref Gtk.Image img)
        {
            Poppler.Page page   = this.pdf.GetPage(this.pageIndex);
            double       width  = 0D;
            double       height = 0D;

            page.GetSize(out width, out height);
            pageHeight = (int)height;

            // It is important to set the image to have the correct size
            img.Pixbuf = new  Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, (int)width, (int)height);
            Gdk.Pixbuf pixbuf = img.Pixbuf;

            page.RenderToPixbuf(0, 0, (int)width, (int)height, 1.0, 0, pixbuf);
            img.Pixbuf = pixbuf;
            vboxImages.Add(img);
        }
        private void RenderPage(ref Gtk.Image img)
        {
            Poppler.Page page   = this.pdf.GetPage(this.pageIndex);
            double       width  = 0D;
            double       height = 0D;

            page.GetSize(out width, out height);
            pageHeight = (int)height;

            // It is important to set the image to have the correct size
            img.Pixbuf = new  Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, (int)width, (int)height);

            using (var sur = new ImageSurface(img.Pixbuf.Pixels, Format.Argb32, (int)width, (int)height, img.Pixbuf.Rowstride))
                using (var con = new Context(sur)) {
                    page.Render(con);
                }

            vboxImages.Add(img);
        }