0
我有一個字符串比它必須顯示的地方的寬度更長。我想要做的是在2或3行顯示字符串。如何在iOS上使用libharu在2/3行中顯示字符串?
我的代碼如下:
for (int i=0; i<claimsCount; i++)
{
File_Claim *fileClaim = [claimsArray objectAtIndex:i];
[self checkCreateNewPage:font:10.0];
///////////////////////////////////////////////////////////////////////////////////////
// if the current category is the same as the previous one then don't write it again
///////////////////////////////////////////////////////////////////////////////////////
if ([subcategory isEqualToString:fileClaim.subCategoryName])
{
}
else
{
// hold the old category to check if it is the same
subcategory = fileClaim.subCategoryName;
//HPDF_Page_SetRGBFill (_currentPage, 0, 0, 1);
posY -= PDF_SPACER_Y;
HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X, posY, [fileClaim.subCategoryName cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
}
//HPDF_Page_SetRGBFill (_currentPage, 0, 0, 0);
posY -= PDF_SPACER_Y;
HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X+15, posY, [fileClaim.name cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
HPDF_Page_TextOut(_currentPage, [self alignRightNumberX:fileClaim.unitPrice:260], posY, [[NSString stringWithFormat:@"%.2f €",fileClaim.unitPrice] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
HPDF_Page_TextOut(_currentPage, 320, posY, [[fileClaim getCalcString] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
HPDF_Page_TextOut(_currentPage, [self alignRightNumberX:fileClaim.totalPrice:483], posY, [[NSString stringWithFormat:@"%.2f €",fileClaim.totalPrice] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
}
而且這裏我把我的文字部分:
HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X+15, posY, [fileClaim.name cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
現在,這已經來2條或3線,而不是1,我可以不知道該怎麼做。
由於提前,
Lewion