Exemplo n.º 1
0
        /// <summary>
        /// Loads the pdf.  This is the function you call when you want to display a pdf.
        /// </summary>
        /// <param name='pdfFileName'>
        /// Pdf file name.
        /// </param>
        private void LoadPdf(Uri pdfFileName)
        {
            pdf = Poppler.Document.NewFromFile(pdfFileName.AbsoluteUri, "");
            PageCountLabel.Text          = @"/" + (pdf.NPages - 1).ToString();
            CurrentPage.Value            = 0;
            CurrentPage.Adjustment.Upper = pdf.NPages - 1;

            foreach (Gtk.Widget w in vboxImages.AllChildren)
            {
                vboxImages.Remove(w);
            }

            for (this.pageIndex = 0; this.pageIndex < pdf.NPages; this.pageIndex++)
            {
                Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, 0, 0);
                Gtk.Image  img    = new Gtk.Image();
                img.Pixbuf = pixbuf;
                img.Name   = "image1";

                //vboxImages.Add (img);
                RenderPage(ref img);
            }

            this.ShowAll();
        }
        /// <summary>
        /// Loads the pdf.  This is the function you call when you want to display a pdf.
        /// </summary>
        /// <param name='pdfFileName'>
        /// Pdf file name.
        /// </param>
        public void LoadPdf(string pdfFileName)
        {
            pdf = Poppler.Document.NewFromFile(pdfFileName, "");
            PageCountLabel.Text = @"/" + (pdf.NPages - 1).ToString();
            CurrentPage.Value = 0;
            CurrentPage.Adjustment.Upper = pdf.NPages-1;

            foreach (Gtk.Widget w in vboxImages.AllChildren)
            {
                vboxImages.Remove(w);
            }

            for (this.pageIndex = 0; this.pageIndex < pdf.NPages; this.pageIndex++)
            {
                Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 0, 0);
                Gtk.Image img = new Gtk.Image();
                img.Pixbuf = pixbuf;
                img.Name = "image1";

                //vboxImages.Add (img);
                RenderPage(ref img);
            }

            this.ShowAll();
        }
Exemplo n.º 3
0
 public FontInfo(Poppler.Document document) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(FontInfo))
     {
         throw new InvalidOperationException("Can't override this constructor.");
     }
     Raw = poppler_font_info_new(document == null ? IntPtr.Zero : document.Handle);
 }
Exemplo n.º 4
0
        public PSFile(Poppler.Document document, string filename, int first_page, int n_pages) : base(IntPtr.Zero)
        {
            if (GetType() != typeof(PSFile))
            {
                throw new InvalidOperationException("Can't override this constructor.");
            }
            IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename);

            Raw = poppler_ps_file_new(document == null ? IntPtr.Zero : document.Handle, native_filename, first_page, n_pages);
            GLib.Marshaller.Free(native_filename);
        }
Exemplo n.º 5
0
        void ExpireThumbnails(IEnumerable <Page> update_pages)
        {
            if (poppler_doc != null)
            {
                poppler_doc.Dispose();
                poppler_doc = null;
            }

            foreach (var page in update_pages)
            {
                page.SurfaceDirty = true;
            }
        }
Exemplo n.º 6
0
 public LayersIter(Poppler.Document document)
 {
     Raw = poppler_layers_iter_new(document == null ? IntPtr.Zero : document.Handle);
 }
Exemplo n.º 7
0
 public IndexIter(Poppler.Document document)
 {
     Raw = poppler_index_iter_new(document == null ? IntPtr.Zero : document.Handle);
 }