Dear poppler people,

Currently I am trying to develop a program to sort documents. For this
program I would like to use poppler to render PDF files. I have made the
following code to try out and gain experience with poppler.
Unfortunately the results is a segmentation fault :-(. I hope someone
here can help me solve the problem.

The following messages are returned when executing the function
"poppler_document_new_from_file": 


(process:15205): GLib-GObject-CRITICAL **: gtype.c:2248: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:15205): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:15205): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed
Segmentation fault


The code compiles without errors or warnings with the following command:

"gcc `pkg-config --libs --cflags glib-2.0 gtk+-2.0 poppler poppler-glib
gdk-2.0 gdk-pixbuf-2.0` test.c -o test"


The system in use is Fedora 9 kernel 2.6.25.11-96.fc9.i686 on a dual
core Intel pentium E2140. The (dev) packages are installed using the
package manager "gpk-application". I am running Gnome but KDE is
installed also.

I hope someone has an idea. Maybe it is something really simple which I
forgot. I thank you for your reply and ideas in advance.

Greetings,


Bart 



The CODE:


#include <glib.h>       
#include <glib-object.h>

#include <glib/poppler.h>
#include <glib/poppler-document.h>
#include <glib/poppler-page.h>

#include <gdk-pixbuf/gdk-pixbuf.h>

#include <gtk/gtk.h>

#include <stdio.h>
#include <stdlib.h>


int main(int   argc,
         char *argv[])
{

        GError *error = NULL;
        GdkPixbuf *pixBuf = NULL;

        gchar *filename_uri = "file:///home/Bart/C/Poppler/test2.pdf";

        printf("DEBUG: line A\n");


// Until here every thing is oke

        PopplerDocument *doc = poppler_document_new_from_file ( 
                                                        filename_uri,
                                                        NULL,
                                                        &error );


// This print statement is not visible. The error occurs above it.
        printf("DEBUG: line B\n");


        if( error != NULL )
        {
                // Report the error
                printf("\n\nError: %s\n", &error->message);             
                exit(1);
        }

        printf("DEBUG: line C\n");

        PopplerPage *page = poppler_document_get_page ( doc,
                                                        0 );

// The next lines are not functional but should not be the problem


        pixBuf = gdk_pixbuf_new ( GDK_COLORSPACE_RGB,
                                FALSE,
                                8,
                                600,
                                900 );


        poppler_page_render_to_pixbuf ( page,
                                        0,
                                        0,
                                        600,
                                        900,
                                        1,
                                        0,
                                        pixBuf);
        
   GtkWidget *window;
    
   gtk_init (&argc, &argv);
    
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_widget_show  (window);
    
   gtk_main ();
    
   return 0;


}




_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to