[poppler] Poppler-cairo hello world

Adrian Johnson ajohnson at redneon.com
Fri Jul 31 02:03:16 PDT 2009


Have a look at the example on the cairo website:

   http://cairographics.org/renderpdf/


cdiddca wrote:
> 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;
> }
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list