1
사용자 지정 글꼴로 새 PDF를 만들려고합니다.사용자 지정 글꼴로 CGContextRef 및 PDF의 NSString 인쇄
사용자 정의 글꼴을로드하고 모든 응용 프로그램에서 사용할 수 있지만 PDF를 사용하려고하면 시스템 글꼴이 인쇄됩니다.
NSString UIKit 추가 기능을 사용하고 있습니다.
+(UIFont *)imagoBook:(float)size{
return [UIFont fontWithName:@"Imago-Book" size:size];
}
-(NSData *)createPDFfromUIView
{
NSMutableData *pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData(pdfData, self.bounds, nil);
UIGraphicsBeginPDFPage();
UIFont *imagoBook13 = [ROCTextsInformation imagoBook:13];
[@"Test" drawAtPoint:CGPointZero withFont:imagoBook13];
UIGraphicsEndPDFContext();
// Retrieves the document directories from the iOS device
NSArray* documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
NSString* documentDirectory = [documentDirectories objectAtIndex:0];
NSString* documentDirectoryFilename = [documentDirectory stringByAppendingPathComponent:@"t.pdf"];
// instructs the mutable data object to write its context to a file on disk
[pdfData writeToFile:documentDirectoryFilename atomically:YES];
NSLog(@"documentDirectoryFileName: %@",documentDirectoryFilename);
return pdfData;
}
실제로보기에서 동일한 컨텍스트를 그리기 때문에 글꼴은 완벽하게 작성되지만 pdf에는 쓰지 않습니다.
글꼴에 otf 파일을 사용하고 있습니다.
Thankssss
무엇이'imagoBook10'입니까? – Kreiri
미안 해요 3 분의 – xarly
잃어버린 정보는 여기에 가능성이 높습니다 : http://stackoverflow.com/questions/8980388/ios-embed-font-in-pdf – ipmcc