I know how to use HPDF_Page_SetTextMatrix to rotate and scale text but I can only seem to use one of these operations at a time.
According to the Adobe PDF Specification, if I am reading it correctly, you should be able to set multiple text matrices and they will be applied one after another so that you could set up a rotation first using HPDF_Page_SetTextMatrix and then immediately set up a scaling operation by using HPDF_Page_SetTextMatrix again.
// rotate by 45 degrees
HPDF_REAL rad = (HPDF_REAL) 45.0 / 180.0 * 3.141592;
HPDF_Page_SetTextMatrix(page, cos(rad), sin(rad), -sin(rad), cos(rad), x, y);
// scale in x direction by 1.5 - ie make the text wider than normal
HPDF_Page_SetTextMatrix(page, 1.5, 0, 0, 1, x, y);
When I try and do this only the last HPDF_Page_SetTextMatrix operation works.
Have I understood the Adobe PDF specification correctly? If so, any chance of the library being changed so that it will record up to three text matrix operations (as this would allow for a rotation, skew and scaling to be applied to one piece of text)?
Multiple 2 matrix before call HPDF_Page_SetTextMatrix.
i.e. use HPDF_Page_SetTextMatrix(page, 1.5 * cos(rad), 1.5 * sin(rad), -sin(rad), cos(rad), x, y);
Thank you very much for your suggestion - it worked just fine.
Log in to post a comment.