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
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:
Replies
Boosts
Views
Activity
Jan ’24
Reply to NSSharingService with email for 3rd-party apps
I have this problem too. Thunderbird is another email client that does not receive attachments, even though canPerformWithItems: returns YES and the delegate's error callback is not called. I've filed FB13507726 about it.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Getting process information in C or C++
Looks like you could do it using the sysctl function, as in this code: https://gist.github.com/s4y/1173880/9ea0ed9b8a55c23f10ecb67ce288e09f08d9d1e5
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to SecStaticCodeCreateWithPath returns -4960 when the path contains empty char
I think you should be using fileURLWithPath:, not URLWithString:.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to PDFKit is not working in MacOs
This code uses Core Graphics, not PDFKit.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to After upgrading to Sonoma 14.2 bitmap images have a black background!
What is the format and size of the image file? There is a known Sonoma bug involving icns files at certain sizes.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Are there any macOS framework references for C?
Are you looking for something specific? You can often find basic information in the framework headers.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Help with Notary tool
I don't know if this will help, but xcrun notarytool help submit indicates that you can add a --verbose option.
Topic: Code Signing SubTopic: Notarization Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Not seeing Apple developer membership renewal option
Don't use the app, log into your account on the web at developer.apple.com.
Replies
Boosts
Views
Activity
Dec ’23
Reply to Ignoring Command-Q in LSUIElement app (macOS, SwiftUI)?
If you implement applicationShouldTerminate in an application delegate, you should be able to decline to quit.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Dec ’23
Reply to How to create paginated PDF from NSTextView?
I also tried making a subclass of NSTextView that overrides rectForPage: and knowsPageRange:, but those methods never got called.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Dec ’23
Reply to error EPERM on attempt to read symlink
I suspect that this will go nowhere, but I filed FB13440366.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23