objective-c - 如何使用石英 2D 在 iOS Objective-C 的 pdf 文本区域中添加行距?
问题描述
我使用核心图形 ( Image ) 创建了一个带有框的 PDF 页面。
我面临一个问题,即评论部分我无法明智地设置“文本”。知道我该怎么做吗?
“评论”部分的代码。
textToDraw=@"Comments:";
newfont=fontName2(7);
renderingRect = CGRectMake(20,146.5, 842, 300.0);
[textToDraw drawInRect:renderingRect withFont:newfont lineBreakMode:nil alignment:nil];
////////////////
CGContextSetLineWidth(currentContext, 1.0);
CGContextMoveToPoint(currentContext, 20,155);
CGContextAddLineToPoint(currentContext,295, 155);
CGContextStrokePath(currentContext);
CGContextSetLineWidth(currentContext, 1.0);
CGContextMoveToPoint(currentContext, 20,170);
CGContextAddLineToPoint(currentContext,295, 170);
CGContextStrokePath(currentContext);
CGContextSetLineWidth(currentContext, 1.0);
CGContextMoveToPoint(currentContext, 20,185);
CGContextAddLineToPoint(currentContext,295, 185);
CGContextStrokePath(currentContext);
CGContextSetLineWidth(currentContext, 1.0);
CGContextMoveToPoint(currentContext, 20,200);
CGContextAddLineToPoint(currentContext,295, 200);
CGContextStrokePath(currentContext);
@try{
textToDraw=@"";
NSString *commentText=@"helo how are you. i am tuna string. i have so many friends. helllo i am working.here is my paragraph writing";
renderingRect = CGRectMake(62, 146, 220, 400);
newfont=fontName2(7);
[commentText drawInRect:renderingRect withFont:newfont lineBreakMode:NSLineBreakByWordWrapping alignment:NSTextAlignmentLeft];
}
@catch(NSException *e){
}
解决方案
推荐阅读
- javascript - 在 Postman 中,如何从 Get 请求中获取响应主体,并将其放入 PUT 请求中并进行细微更改
- javascript - 如何在 js 中将文档 (html) 转换为字符串 var?
- html - 在响应式设计中堆叠表格行的确定方法 - 有或没有媒体查询?
- java - 如何使用 Java 访问 Ilog Cplex 中的多维决策变量数组
- python - 我想在 centos 7.5 上为 Python-2.7.15 pkg 创建 rpm
- mysql - 将 MySQL 数据库从一台 PC 移动到另一台 PC
- sequelize.js - feathers-sequelize Left Join Database Postgresql
- dart - Flutter:打开 iOS iPhone 设置页面
- excel - Worksheetfunction.find 没有更多值要查找
- c - PostgreSQL C 语言函数中的 Datum 到底是什么?