EvinceDev : File type document PDF (application/pdf) is not supported
Hello,
I wanted to play with gtk and evince but I get this error :
File type document PDF (application/pdf) is not supported
However, when I open a pdf with Evince it works very well.
Here is the sample code I try to run with this which maybe wrong gcc
pkg-config --cflags evince-view-3.0 gtk+-3.0 poppler-glib libxml-2.0-o example-0 test.c
pkg-config --libs evince-view-3.0 gtk+-3.0 poppler-glib libxml-2.0`` :
#include <gtk/gtk.h>
#include <evince/3.0/evince-document.h>
#include <evince/3.0/evince-view.h>
int main(int argc, char *argv[]){
GtkWidget *window;
GError *error = NULL;
GFile *file = g_file_new_for_uri ("file:///home/mathyew/Documents/sample-evince/dummy.pdf");
EvDocument *document = ev_document_factory_get_document_for_gfile (file, EV_DOCUMENT_LOAD_FLAG_NONE, NULL, &error);
if (error)
{
g_message ("Error : %s", error->message);
return 0;
}
EvDocumentModel *docmodel = ev_document_model_new_with_document (EV_DOCUMENT(document));
GtkWidget *view;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
view = ev_view_new();
ev_view_set_model(EV_VIEW(view), EV_DOCUMENT_MODEL(docmodel));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
gtk_widget_show_all(window);
gtk_main();
return 0;
}
I tested on debian buster with evince 3.30.2 and on ubuntu focal 3.36.7.
Also, I wanted to see the documentations here about libevdocument but I don't see the docs related to ev-document-factory
or any exemple with compile flags (which would be very helpful) and if I click on the other links it's empty.....
If it's a miskate of mine, so I'm sorry to have bothering you
Cordially