I came up with yet another approach: I inserted the text view in an NSClipView, which I inserted in a printing-aware container view, and then printed to a temporary PDF file, like this:
NSPrintInfo* printInfo = [[NSPrintInfo alloc] init];
printInfo.paperSize = pageBounds.size;
printInfo.topMargin = 0.0;
printInfo.bottomMargin = 0.0;
printInfo.leftMargin = 0.0;
printInfo.rightMargin = 0.0;
printInfo.horizontallyCentered = NO;
printInfo.verticallyCentered = NO;
printInfo.verticalPagination = NSPrintingPaginationModeAutomatic;
printInfo.horizontalPagination = NSPrintingPaginationModeClip;
printInfo.jobDisposition = NSPrintSaveJob;
printInfo.dictionary[NSPrintJobSavingURL] = tempPDFURL;
NSPrintOperation* printOp = [NSPrintOperation
printOperationWithView: container
printInfo: printInfo];
printOp.showsProgressPanel = NO;
printOp.showsPrintPanel = NO;
[printOp runOperation];
It works, except for one thing. My text contains some link attributes. When creating PDF using the PDF-specific methods like dataWithPDFInsideRect:, those links turn into PDF annotations. When printing this way, the links just go away. Aargh.