I'm trying to generate a pdf file with the lib haru on c++.
But I don't know how to write a text in a filled rectangle:
// draw and fill/stroke a rectangle
HPDF_Page_SetRGBFill(page, 0.75, 0.75, 0.75);
HPDF_Page_Rectangle(page, 50, 100, 200, 50);
HPDF_Page_FillStroke(page);
// try to put a text in the rectangle.
HPDF_Page_SetFontAndSize (page, HPDF_GetFont (pdf, "Helvetica", "CP1252"), 8);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 70, 120, "test");
HPDF_Page_EndText (page);
There is no bug returned, but the text is not printed.
What is the problem ?
Thank you !
EDIT:
Ok the problem was that i forgot to change the fill color: I had to add:
HPDF_Page_SetRGBFill(page, 0.0, 0.0, 0.0);
before the PDF_Page_BeginText function.