[poppler] Poppler-cairo hello world

cdiddca cdiddca at gmail.com
Fri Jul 31 08:22:05 PDT 2009


Thanks.

On 7/31/09, Adrian Johnson <ajohnson at redneon.com> wrote:
> 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