[poppler] Error getting doc from file (newbie)
Joao Moreira
joao.moreira at free.fr
Sun Jun 3 07:27:19 PDT 2007
Hi,
I'm trying the simplest possible example to start working with poppler, and I
can't get the document to open. The error message says :
The URI '/home/joao/unidialog/200503.pdf' is not an absolute URI using the "file" scheme
but if I try to prepend "file://" or "file:///" I get a segmentation fault...
Here's my C++ code below. Can anyone tell me how this is supposed to work ? the
reference manual that comes with the poppler source is somewhat..terse :-)
Thanks,
Joao
//------------------------------------------------------------------------------
// pdf -- first test using poppler
//------------------------------------------------------------------------------
#include <iostream.h>
#include <glib.h>
#include <glib/poppler.h>
class Pdf {
public:
Pdf(const char *filename);
private:
PopplerDocument *doc;
};
Pdf::Pdf(const char *filename) {
GError *err = NULL;
doc = poppler_document_new_from_file(filename, NULL, &err);
if(err != NULL) {
cout << "Can\'t open " << filename << "\n";
cout << err->message << "\n";
}
}
int
main(int argc, char **argv)
{
char *filename = "/home/joao/unidialog/200503.pdf";
Pdf *pdf = new Pdf(filename);
}
--
Joao Moreira de Sa Coutinho
joao.moreira at free.fr
More information about the poppler
mailing list