これら2つの違いにdraw
これらtext
を入れPDF
たとき、私はそれを理解できません。truncate
specific width
最初のもの:
NSString *strText12 = @"HASDHADH skjdfhhs HKSJDHF.;; []'.hfkjhsfS SDHJHFSH jsfsjdfsn eiwj NJSDSJDF SDLKJJ sfkjsj wreoiwuowu 87243 7298 72jsdj h@#$$$!@$$";
if (strText12.length > 110 ) {
strText12 = [strText12 substringToIndex:110];
strText12 = [strText12 stringByAppendingFormat:@"...."];
}
CGContextSelectFont (aCgPDFContextRef, "Helvetica", 12, kCGEncodingMacRoman);
CGContextSetTextDrawingMode (aCgPDFContextRef, kCGTextFill);
CGContextSetRGBFillColor (aCgPDFContextRef, 0, 0, 0, 1);
const char *text1 = [strText12 UTF8String];
CGContextShowTextAtPoint (aCgPDFContextRef, 10,50.0, text1, strlen(text1));
2 つ目:
NSString *strText = @"hasdhadh skjdfhhs hksjdhf.;; []'.hfkjhsfs sdhjhfsh jsfsjdfsn eiwj njsdsjdf sdlkjj sfkjsj wreoiwuowu 87243 7298 72jsdj h@#$$$!@$$";
if (strText.length > 110 ) {
strText = [strText substringToIndex:110];
strText = [strText stringByAppendingFormat:@"...."];
}
CGContextSelectFont (aCgPDFContextRef, "Helvetica", 12, kCGEncodingMacRoman);
CGContextSetTextDrawingMode (aCgPDFContextRef, kCGTextFill);
CGContextSetRGBFillColor (aCgPDFContextRef, 0, 0, 0, 1);
const char *text = [strText UTF8String];
CGContextShowTextAtPoint (aCgPDFContextRef, 10,10.0, text, strlen(text));
PDF の結果:
編集:使用してもCoreText
result
ですsame
。