[cairo] Strange problem with PDF generation

Umberto Allievi uallievi at iol.it
Tue Jan 30 10:13:04 PST 2007

this small program is giving me a big headache ...

#include <iostream>
#include <cairomm/cairomm.h>
#include <cairomm/context.h>

#define SURF_DPI double(72)

int main()
 	double width = SURF_DPI*8.268; //210 mm
	double height = SURF_DPI*11.693; //297 mm
	//Cairo::RefPtr<Cairo::PsSurface> surf =
	Cairo::RefPtr<Cairo::PdfSurface> surf =
	Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surf);
	cr->select_font_face ("Arial", Cairo::FONT_SLANT_NORMAL,
 	cr->set_font_size (10);	
	cr->show_text("This should print correctly, ");
	cr->show_text("but it does not !");
    	cr->show_page ();
	std::cout << "Hello world" << std::endl;
	return 0;

The generated pdf looks good when viewed in both evince and acrobat
reader, but when printed (even with cups-PDF) it ...
 - looks weird if printed with acrobat reader
 - evince outputs a blank sheet
If I generate a PS file everything is OK.

I've tested this with both cairo 1.3.12 and cairo 1.2.6 in FC6 32 and 64
bit and in GTK-Win32

can someone help me ??
	Thanks in Advance


More information about the cairo mailing list