Hi,
I have the following code that writes a textrun to a pdf.
I have a rectangle named "rectTextBox" that has a height of 54 and a width of 200.
CGRect rectTextBox = CGRectMake(testX0, testY0, (testX1 - testX0), (testY1 - testY3));
double widthTextBox = rectTextBox.size.width;
double heightTextBox = rectTextBox.size.height;
I'm using the width and the height of the textBox as parameter A and D in the function SetTextMatrix.
Why does it return a text with a fontsize 1 x 54? instead of just filling the rectangle with text ?
How does one calculate the font size if we just have a rectangle for the text?
PTElement *element = [elementBuilder CreateRect: testX3 y: testY3 width: widthTextBox height: heightTextBox];
element = [elementBuilder CreateTextRunWithFont: string font: [PTFont Create: [pdfDocument GetSDFDoc] type: e_ptcourier embed: NO] font_sz: 1];
[element SetTextMatrix: widthTextBox b: 0 c: 0 d: heightTextBox h: testX3 v: testY3];
PTGState *gstate = [element GetGState];
[gstate SetFillColorSpace: [PTColorSpace CreateDeviceCMYK]];
[gstate SetFillColorWithColorPt: [[PTColorPt alloc] initWithX: 1 y: 0 z: 0 w:0]];
[gstate SetFillOpacity: 0.5];
[elementWriter WriteElement: element];
[elementWriter WriteElement:[elementBuilder CreateTextEnd]];