[poppler] Poppler-cairo hello world

cdiddca cdiddca at gmail.com
Fri Jul 31 02:55:28 PDT 2009


Could someone help fix that for me ? I want to 
render to custom cairo surface. I get segfault 
in pthread in displayPage function. 

#include <cairo.h>
#include <PDFDoc.h>
#include <CairoOutputDev.h>
#include <goo/GooString.h>


int main(int argc, char *argv[])
{
    cairo_surface_t *surface;
    cairo_t *cr;

    GooString path("/path/to/pdf.pdf");	    	

    PDFDoc *document;
    CairoOutputDev *output_dev;

    document = new PDFDoc(&path);
    output_dev = new CairoOutputDev();	

    output_dev->startDoc(document->getXRef(), document->getCatalog());

    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 5000, 5000);
    cr = cairo_create (surface);

    output_dev->setCairo (cr);

    document->displayPage(output_dev, 0, 72.0, 72.0, 0, gFalse, gTrue, gFalse);

    cairo_destroy(cr);

    return 0;
}


More information about the poppler mailing list