Post

Replies

Boosts

Views

Activity

Reply to How to add UISimpleTextPrintFormatter to the second page?
I managed to create a workaround by overwriting `drawPrintFormatter:forPageAtIndex:` in a `UIPrintPageRenderer` subclass:- (void)drawPrintFormatter:(UIPrintFormatter *)printFormatter forPageAtIndex:(NSInteger)pageIndex { if ([NSStringFromClass([printFormatter class]) isEqualToString:@"UITextViewPrintFormatter"]) { pageIndex = pageIndex - printFormatter.startPage; } return [super drawPrintFormatter:printFormatter forPageAtIndex:pageIndex]; }The code checks if the printFormatter is of `UITextViewPrintFormatter` type, since this seems to replace the `UISimpleTextPrintFormatter` that is passed to the renderer. The `pageIndex` is adjusted based on the `startPage`, since this seems to already be the behavior for `UIMarkupTextPrintFormatter`, and this is the expected behavior when passing the renderer as an activity to `UIActivityViewController`.
Dec ’19
Reply to How to add UISimpleTextPrintFormatter to the second page?
I know it's been a long time since this was posted, but this is still an issue in iOS 13.Even without using a custom `UIPageRenderer`, this crashes when adding multiple `UISimplePrintFormatter` to it (same crash reported by OP).Has anyone found any workarounds? One alternative would be to use the `UIMarkupTextPrintFormatter` instead, which I'll probably go with if I can't find no other solutions.
Dec ’19