[cairo] PostScript Document

Alessandro Oliva cairo at microsignum.com
Mon Nov 20 01:16:04 PST 2006


Hy list!

is it possible to save ps file, with both images, text and lines ?

with this code I am only able to save text and lines,
but I want to also insert images from file (jpg)

thanks!


//-----------CODE--------------------------------------
cairo_surface_t    *surface;
cairo_t    *cr;
double width_in_points, height_in_points;
   
    width_in_points  =  210 * INCHES_PER_MM * POINTS_PER_INCH;
    height_in_points = 29.7 * INCHES_PER_MM * POINTS_PER_INCH;
   
    surface = cairo_ps_surface_create(nome_file_ps, width_in_points, 
height_in_points);
   
    cairo_ps_surface_dsc_comment (surface, "%IncludeFeature: *PageSize A4");

    cr = cairo_create(surface);
  
    cairo_set_source_rgb (cr, 0, 0, 0); //nero!
    cairo_move_to (cr, 20, 10);
    //cairo_line_to (cr, 40, 20);
 
    cairo_rectangle (cr, 10, -600, 100, 50);
    cairo_fill (cr);
   
    cairo_select_font_face (cr, "Sans", 
CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size(cr,14) ;
    cairo_set_source_rgb(cr,0,0,0) ;
    cairo_move_to(cr,20,40) ;
    cairo_show_text(cr,"text") ;  
   
    cairo_show_page(cr);
    cairo_surface_destroy(surface);
    cairo_destroy(cr);
//-----------CODE--------------------------------------


More information about the cairo mailing list