Я использую следующий псевдокод для создания документа PDF:
CGContextRef context = CGPDFContextCreateWithURL(url, &rect, NULL);
for (int i = 1; i <= N; i++)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CGContextBeginPage(context, &mediaBox);
// drawing code
CGContextEndPage(context);
[pool release];
}
CGContextRelease(context);
Он очень хорошо работает с небольшими документами ( N <100
страниц), но он использует слишком много
memory and crashes if the document has more than about 400 pages (it received
two memory warnings before crashing.) I have made sure there were no leaks using
Инструменты. Что вы посоветуете по созданию больших PDF-документов на iOS? Большое спасибо.
edit: PDF-файл создается в фоновом потоке.