Post

Replies

Boosts

Views

Activity

Reply to Making filecopy faster by changing block size
I'm asking because the value returned by URLResourceKey.preferredIOBlockSizeKey for my Macintosh HD is 1048576, but significantly increasing the block size of filecopy from the "preferred" 1KB to 1MB or higher usually performs better. Why do you say preferred 1KB, when in the same sentence you say the preferred block size is 1MB?
Topic: App & System Services SubTopic: General Tags:
Jan ’24
Reply to How to create paginated PDF from NSTextView?
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.
Topic: UI Frameworks SubTopic: AppKit Tags:
Dec ’23
Reply to How to create paginated PDF from NSTextView?
Thanks for writing, and I don’t doubt that your approach would work, but I don’t get why creating PDF should be fundamentally harder than any other multi page print job, since it’s just a special case. By the way, I tried making a non-PDF NSPrintOperation, and that produced multiple pages that were all blank. Apple’s docs gave me the impression that it shouldn’t be so hard to print a view.
Topic: UI Frameworks SubTopic: AppKit Tags:
Dec ’23
Reply to How to create paginated PDF from NSTextView?
I tried this NSMutableData* pdfData = [[NSMutableData alloc] init]; NSPrintOperation* printOp = [NSPrintOperation PDFOperationWithView: textView insideRect: pageBounds toData: pdfData printInfo: NSPrintInfo.sharedPrintInfo]; [printOp runOperation]; and it still creates only one page.
Topic: UI Frameworks SubTopic: AppKit Tags:
Dec ’23