hi...<br>
<br>
I know this is a repeat question but have been stuck on this for 4-5 days... pls b considerate...<br>
<br>
I have been trying to print text on to a PDF/PS document using cairo..(Have attached my code below...)<br>
<br>
Am using the code from the example of pdf-surface create..<br>
I have only substituted the arc code with text one...<br>
My code compiles & runs fine.. <br>
<br>
But the pdf doc created doesn't display any text...(its just plain white)...<br>
<br>
Where am I going wrong...<br>
<br>
Also I have to print a lot of text on the pdf (table of 6 col X 30
rows), do I have to use cairo_glyph_t ,cairo_show_glyphs() .... ??<br>
<br>
And for printing the text onto the PDF/PS do I have to use cairo_pdf_surface_create_for
<div id="mb_0">_stream ()......<br>
<br>
pls reply I have had only one answer to my previous mail.<br>
<br>
bye<br>
rushi<br>
<br>
//basket.c<br>
/* Author: Carl D. Worth <<a href="mailto:cworth@isi.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">cworth@isi.edu</a>> */<br>
<br>
#include <cairo.h><br>
#include <cairo-ps.h><br>
#include <math.h><br>
<br>
void<br>
draw (cairo_t *cr);<br>
<br>
#define X_INCHES 8<br>
#define Y_INCHES 3<br>
<br>
#define FILENAME "<a href="http://basket.ps/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">basket.ps</a>"<br>
<br>
int<br>
main (void)<br>
{<br>
cairo_surface_t *surface;<br>
cairo_t *cr;<br>
FILE *file;<br>
<br>
file = fopen (FILENAME, "w");<br>
if (file == NULL) {<br>
fprintf (stderr, "Failed to open file %s for writing.\n", FILENAME);<br>
return 1;<br>
}<br>
<br>
surface = cairo_ps_surface_create (FILENAME,<br>
X_INCHES * 72.0,<br>
Y_INCHES * 72.0);<br>
<br>
cr = cairo_create (surface);<br>
<br>
draw (cr);<br>
cairo_show_page (cr);<br>
<br>
cairo_destroy (cr);<br>
<br>
cairo_surface_destroy(surface);<br>
<br>
fclose (file);<br>
<br>
return 0;<br>
}<br>
<br>
void<br>
draw (cairo_t *cr)<br>
{<br>
cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,<br>
CAIRO_FONT_WEIGHT_BOLD);<br>
cairo_set_font_size(cr,72) ;<br>
cairo_set_source_rgb(cr,0,0,0) ;<br>
cairo_move_to(cr,20,100) ;<br>
cairo_show_text(cr,"Hello world !") ;<br>
}<br>
<br>
</div>