An example of using Cairo::PsSurface class to render to PostScript
#if defined(_MSC_VER)
#define _USE_MATH_DEFINES
#endif
#include <cairommconfig.h>
#include <cairomm/context.h>
#include <cairomm/surface.h>
int main()
{
#ifdef CAIRO_HAS_PS_SURFACE
std::string filename =
"image.ps";
double width = 600;
double height = 400;
cr->
rectangle(0.0, 0.0, cairo_image_surface_get_width(surface->
cobj()), height);
cr->
arc(width / 2.0, height / 2.0,
height / 4.0, 0.0, 2.0 * M_PI);
cr->
move_to(width / 4.0, height / 4.0);
cr->
line_to(width * 3.0 / 4.0, height * 3.0 / 4.0);
std::cout <<
"Wrote PostScript file \"" << filename <<
"\"" <<
std::endl;
return 0;
#else
std::cout << "You must compile cairo with PS (Postscript) support for this example to work."
<< std::endl;
return 1;
#endif
}