coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.43k stars 431 forks source link

Error when trying to print to PDF #997

Closed crankygeologist closed 5 years ago

crankygeologist commented 5 years ago

Environment

Short Description

Error when trying to print to PDF

Steps to Reproduce the Issue

CMD-P Select "PDF" in the bottom, left corner. Save the PDF to a location. Pop-up window displays "Error while printing." PDF is not created.

Expected Result

PDF to be created using the macOS built-in print-to-PDF functionality.

1024jp commented 5 years ago

Thank you for the report. It works at least under my current environment (macOS 10.14.6). I'll try macOS 10.15 Catalina later.

1024jp commented 5 years ago

I've got a similar issue from another user.


Environment (環境)

Short Description (簡単な説明)

canon MG7130 プリンタを使用していますが、Bonjourマルチファンクション(AirPrint)の際、 プレビュー(サムネイル)が表示されません (canon IJ Networkですとちゃんと表示されます)

Steps to Reproduce the Issue (不具合が発生したときに行っていた操作、または再現手順)

プリントする際の画面で。

Expected Result (期待される挙動)

プレビュー(サムネイル)の表示

1024jp commented 5 years ago

Ok, I tried Catalina and found something goes wrong... Must be fixed.

1024jp commented 5 years ago

I changed some implementation of the document printing in CotEditor 3.8.3, which was released today. Is your issue fixed?

crankygeologist commented 5 years ago

Thank you. I updated to the latest version of CotEditor and the issue is not fixed. Printing to PDF worked once, then failed each time after that. It looks like there might be a permissions issue with CotEditor writing the file to my user directories. Here is some error log info that might be helpful:

Oct 21 13:41:03 AppleCore com.apple.xpc.launchd[1] (com.adobe.accmac.ACCFinderSync.41BE6560-689D-4181-9582-2C95E4B87912[1814]): Caller wanted oneshot behavior for pre-existing instance: caller = com.apple.appki

error 13:40:10.145718-0800 CotEditor CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: 'com.apple.print.PrintingCocoaPDEs'

fault 13:40:10.145759-0800 CotEditor CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: 'com.apple.print.PrintingCocoaPDEs'

error 13:40:12.451144-0800 ACCFinderSync CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: 'com.adobe.accmac.ACCFinderSync'

fault 13:40:12.451200-0800 ACCFinderSync CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: 'com.adobe.accmac.ACCFinderSync'

Sandbox: CotEditor(1790) deny(1) file-read-xattr /Users/pappkr/Desktop Violation: deny(1) file-read-xattr /Users/pappkr/Desktop Process: CotEditor [1790] Path: /Applications/CotEditor.app/Contents/MacOS/CotEditor Load Address: 0x10fb33000 Identifier: com.coteditor.CotEditor Version: 379 (3.8.3) Code Type: x86_64 (Native) Parent Process: launchd [1] Responsible: /Applications/CotEditor.app/Contents/MacOS/CotEditor User ID: 501

Date/Time: 2019-10-21 13:41:32.916 AKDT OS Version: Mac OS X 10.15 (19A602) Report Version: 8

MetaData: {"profile-flags":0,"uid":501,"responsible-process-user-uuid":"C25B3EBD-C7ED-4871-B1F6-C05D23C3C5A1","responsible-process-path":"\/Applications\/CotEditor.app\/Contents\/MacOS\/CotEditor","vnode-type":"DIRECTORY","file-mode":448,"target":"\/Users\/pappkr\/Desktop","hardlinked":false,"errno":1,"team-id":"HT3Z3A72WZ","process":"CotEditor","process-path":"\/Applications\/CotEditor.app\/Contents\/MacOS\/CotEditor","path":"\/Users\/pappkr\/Desktop","matched-user-intent-extension":false,"platform-policy":false,"file-flags":0,"normalized_target":["Users","pappkr","Desktop"],"mount-rdev":16777220,"apple-internal":false,"build":"Mac OS X 10.15 (19A602)","primary-filter":"path","action":"deny","container":"\/Users\/pappkr\/Library\/Containers\/com.coteditor.CotEditor\/Data","pid":1790,"summary":"deny(1) file-read-xattr \/Users\/pappkr\/Desktop","operation":"file-read-xattr","storage-class":"kTCCServiceSystemPolicyDesktopFolder","responsible-process-uid":501,"rdev":0,"hardware":"Mac","platform-binary":false,"signing-id":"com.coteditor.CotEditor","flags":5,"xattr":"com.apple.icloud.desktop","matched-extension":false,"platform_binary":"no","profile-in-collection":false,"primary-filter-value":"\/Users\/pappkr\/Desktop"}

Thread 0 (id: 25346): 0 libsystem_kernel.dylib 0x00007fff67f62146 mach_msg_trap + 10 1 libxpc.dylib 0x00007fff68063d80 _xpc_send_serializer + 96 2 libxpc.dylib 0x00007fff6806dac6 _xpc_pipe_simpleroutine + 79 3 libxpc.dylib 0x00007fff68063d08 xpc_pipe_simpleroutine + 42 4 libsystem_trace.dylib 0x00007fff6804870d _os_activity_stream_reflect_block_invoke + 29 5 libdispatch.dylib 0x00007fff67dc94de _dispatch_client_callout + 8 6 libdispatch.dylib 0x00007fff67dcbbf1 _dispatch_block_invoke_direct + 245 7 libdispatch.dylib 0x00007fff67dcbaf1 dispatch_block_perform + 124 8 libsystem_trace.dylib 0x00007fff680481b9 _os_activity_stream_reflect + 530 9 libsystem_trace.dylib 0x00007fff6804c460 _os_log_impl_stream + 535 10 libsystem_trace.dylib 0x00007fff680411bd _os_log_impl_flatten_and_send + 8514 11 libsystem_trace.dylib 0x00007fff6804c22c _os_log + 162 12 libsystem_trace.dylib 0x00007fff6804ebc8 _os_log_debug_impl + 9 13 CoreFoundation 0x00007fff30c96685 -[CFPrefsSearchListSource alreadylocked_copyValueForKey:].cold.2 + 107 14 CoreFoundation 0x00007fff30b0f2ba -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 558 15 CoreFoundation 0x00007fff30b0f06c -[CFPrefsSource copyValueForKey:] + 47 16 CoreFoundation 0x00007fff30b0f02a 76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke + 32 17 CoreFoundation 0x00007fff30af884c 108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 381 18 CoreFoundation 0x00007fff30af847f -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 364 19 CoreFoundation 0x00007fff30af820e -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 145 20 CoreFoundation 0x00007fff30af7eb4 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 101 21 CoreFoundation 0x00007fff30af7e28 _CFPreferencesGetAppBooleanValueWithContainer + 17 22 Foundation 0x00007fff331b7e05 -[NSUserDefaults(NSUserDefaults) boolForKey:] + 82 23 AppKit 0x00007fff2dde4b81 _NSWindowConstructShadowParameters + 1023 24 AppKit 0x00007fff2dde4764 -[NSWindow shadowParameters] + 71 25 AppKit 0x00007fff2ddb97b9 -[NSWindow _setShadowParameters] + 50 26 AppKit 0x00007fff2de6f51a -[NSWindow _reallyDoOrderWindowAboveOrBelow:relativeTo:findKey:forCounter:force:isModal:] + 1576 27 AppKit 0x00007fff2de6ee0f -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 135 28 AppKit 0x00007fff2de6dc33 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 283 29 AppKit 0x00007fff2de6dab7 -[NSWindow orderWindow:relativeTo:] + 155 30 AppKit 0x00007fff2de6c67f -[NSWindow makeKeyAndOrderFront:] + 60 31 AppKit 0x00007fff2e570ee1 103-[NSWindowStackController _doTabSelectionAndWindowOrderingAtIndex:makeKeyAndOrderFront:justOrderFront:]_block_invoke + 243 32 AppKit 0x00007fff2dd6d0ee NSPerformVisuallyAtomicChange + 132 33 AppKit 0x00007fff2e570c73 -[NSWindowStackController _doTabSelectionAndWindowOrderingAtIndex:makeKeyAndOrderFront:justOrderFront:] + 835 34 AppKit 0x00007fff2e360cd8 -[NSTabBar selectTabButton:] + 164 35 AppKit 0x00007fff2e362072 -[NSTabBar _trackMouseEventsForEvent:onTabAtIndex:] + 146 36 AppKit 0x00007fff2e3617a4 -[NSTabBar mouseDown:] + 312 37 AppKit 0x00007fff2df407f9 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4907 38 AppKit 0x00007fff2de83e80 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612 39 AppKit 0x00007fff2de8320d -[NSWindow(NSEventRouting) sendEvent:] + 349 40 AppKit 0x00007fff2dd46618 -[NSApplication(NSEvent) sendEvent:] + 352 41 AppKit 0x00007fff2dd36005 -[NSApplication run] + 707 42 AppKit 0x00007fff2dd27e7d NSApplicationMain + 777 43 CotEditor 0x000000010fb34fb9 44 libdyld.dylib 0x00007fff67e19405 start + 1 45 CotEditor 0x0000000000000001

Thread 1 (id: 25417, com.apple.NSEventThread): 0 libsystem_kernel.dylib 0x00007fff67f62146 mach_msg_trap + 10 1 CoreFoundation 0x00007fff30b1b19b CFRunLoopServiceMachPort + 322 2 CoreFoundation 0x00007fff30b1a737 CFRunLoopRun + 1695 3 CoreFoundation 0x00007fff30b19e13 CFRunLoopRunSpecific + 499 4 AppKit 0x00007fff2dd44026 _NSEventThread + 132 5 libsystem_pthread.dylib 0x00007fff68025d76 _pthread_start + 125 6 libsystem_pthread.dylib 0x00007fff680225d7 thread_start + 15

Thread 2 (id: 27086): 0 libsystem_kernel.dylib 0x00007fff67f62146 mach_msg_trap + 10 1 libxpc.dylib 0x00007fff68063d80 _xpc_send_serializer + 96 2 libxpc.dylib 0x00007fff6806dac6 _xpc_pipe_simpleroutine + 79 3 libxpc.dylib 0x00007fff68063d08 xpc_pipe_simpleroutine + 42 4 libsystem_trace.dylib 0x00007fff6804870d ___os_activity_stream_reflect_block_invoke + 29 5 libdispatch.dylib 0x00007fff67dc94de _dispatch_client_callout + 8 6 libdispatch.dylib 0x00007fff67dcbbf1 _dispatch_block_invoke_direct + 245 7 libdispatch.dylib 0x00007fff67dcbaf1 dispatch_block_perform + 124 8 libsystem_trace.dylib 0x00007fff680481b9 _os_activity_stream_reflect + 530 9 libsystem_trace.dylib 0x00007fff6804c460 _os_log_impl_stream + 535 10 libsystem_trace.dylib 0x00007fff680411bd _os_log_impl_flatten_and_send + 8514 11 libsystem_trace.dylib 0x00007fff6804c22c _os_log + 162 12 libsystem_trace.dylib 0x00007fff6804cb84 _os_log_impl + 9 13 LaunchServices 0x00007fff322a7429 LSNotificationReceiver::receiveNotificationFromServer(_xpc_connection_s, void) + 1047 14 libxpc.dylib 0x00007fff68064078 _xpc_connection_call_event_handler + 56 15 libxpc.dylib 0x00007fff68062268 _xpc_connection_mach_event + 927 16 libdispatch.dylib 0x00007fff67dc957e _dispatch_client_callout4 + 9 17 libdispatch.dylib 0x00007fff67ddeaeb _dispatch_mach_msg_invoke + 435 18 libdispatch.dylib 0x00007fff67dce950 _dispatch_lane_serial_drain + 263 19 libdispatch.dylib 0x00007fff67ddf63e _dispatch_mach_invoke + 481 20 libdispatch.dylib 0x00007fff67dce950 _dispatch_lane_serial_drain + 263 21 libdispatch.dylib 0x00007fff67dcf422 _dispatch_lane_invoke + 363 22 libdispatch.dylib 0x00007fff67dd8aa1 _dispatch_workloop_worker_thread + 598 23 libsystem_pthread.dylib 0x00007fff68022763 _pthread_wqthread + 290 24 libsystem_pthread.dylib 0x00007fff680225c3 start_wqthread + 15

Thread 3 (id: 27180): 0 libsystem_kernel.dylib 0x00007fff67f6525a getxattr + 10 1 FileProvider 0x00007fff3309181e -[NSURL(FPAdditions) fp_matchesFileProviderHeuristics:] + 142 2 FileProvider 0x00007fff3309ed21 FPURLMightBeInFileProvider + 32 3 FileProvider 0x00007fff330a5fb2 FPUbiquitousDocumentMainWindowDidChange + 69 4 AppKit 0x00007fff2e42606a __63+[NSFrontmostDocumentWindowObserver _mainWindowOrURLsDidChange]_block_invoke + 155 5 libdispatch.dylib 0x00007fff67dc8553 _dispatch_call_block_and_release + 12 6 libdispatch.dylib 0x00007fff67dc94de _dispatch_client_callout + 8 7 libdispatch.dylib 0x00007fff67dcea9e _dispatch_lane_serial_drain + 597 8 libdispatch.dylib 0x00007fff67dcf455 _dispatch_lane_invoke + 414 9 libdispatch.dylib 0x00007fff67dd8aa1 _dispatch_workloop_worker_thread + 598 10 libsystem_pthread.dylib 0x00007fff68022763 _pthread_wqthread + 290 11 libsystem_pthread.dylib 0x00007fff680225c3 start_wqthread + 15

Thread 4 (id: 27285): 0 libsystem_kernel.dylib 0x00007fff67f63b7a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff680225c3 start_wqthread + 15

Thread 5 (id: 27287):

Binary Images: 0x10fb33000 - 0x10fdcdff7 com.coteditor.CotEditor (3.8.3 - 379) <3964a743-5ba4-3862-b8f4-77464de7e35a> /Applications/CotEditor.app/Contents/MacOS/CotEditor 0x7fff2dd25000 - 0x7fff2ead1ff9 com.apple.AppKit (6.9 - 1894) <1f4fbef8-f3ac-31c2-bf04-381bc72e36d1> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x7fff30ae0000 - 0x7fff30f5fff7 com.apple.CoreFoundation (6.9 - 1671.15) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff32287000 - 0x7fff324bfff1 com.apple.LaunchServices (1069.2 - 1069.2) <68b4c10c-d536-33e9-9719-e7ba5b753f2b> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices 0x7fff33061000 - 0x7fff33183fff com.apple.FileProvider (253 - 253) /System/Library/Frameworks/FileProvider.framework/Versions/A/FileProvider 0x7fff3319b000 - 0x7fff33562ff3 com.apple.Foundation (6.9 - 1671.15) <4beab72d-10aa-3009-b0f5-b82b4fe1c441> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 0x7fff67dc6000 - 0x7fff67e07ff0 libdispatch.dylib (1173.0.3) /usr/lib/system/libdispatch.dylib 0x7fff67e08000 - 0x7fff67e3dfff libdyld.dylib (732.8) <98960e27-a08b-36da-a5cb-8538b2d6757e> /usr/lib/system/libdyld.dylib 0x7fff67f61000 - 0x7fff67f8dfff libsystem_kernel.dylib (6153.11.26) <4ce9d54a-a975-348e-b878-ee74edfc956b> /usr/lib/system/libsystem_kernel.dylib 0x7fff68020000 - 0x7fff6802afff libsystem_pthread.dylib (416.11.1) <2ea6f95f-f264-30b6-8af2-24197b5aed84> /usr/lib/system/libsystem_pthread.dylib 0x7fff6803b000 - 0x7fff68051ff2 libsystem_trace.dylib (1147.0.3) <5836645e-9862-326d-ab3b-a19e76be29b9> /usr/lib/system/libsystem_trace.dylib 0x7fff68059000 - 0x7fff6808dff6 libxpc.dylib (1738.11.1) <2e9076cd-6c0e-38b6-8403-b2ddce125fbf> /usr/lib/system/libxpc.dylib

1024jp commented 5 years ago

@crankygeologist Thank you for the follow-up.

Hmmm, it looks like something goes wrong in Catalina's PDF creation... In term of PDF creation via the Print dialog, CotEditor just undertakes drawing on the PDF and let the system create PDF file. Well, I'll reseach it somemore.

How about when you do the same procedure with, for instance, TextEdit.app?

1024jp commented 5 years ago

cf. [Catalina] CoreUI annoying error logs –Apple Developer Forums

1024jp commented 5 years ago

@crankygeologist Does running "First Aid" in /Applications/Utilities/Disk Utility.app or the following command helps you?

$ diskutil resetUserPermissions / `id -u`

https://discussions.apple.com/thread/250611334

crankygeologist commented 5 years ago

Thanks for the follow-up and suggestions. I ran the command and rebooted, but the problem remains.

crankygeologist commented 5 years ago

I also tried uninstalling CotEditor, rebooting, and installing the app again. I also tried running the command:

sudo chmod -R -N /Users/

I have been experiencing other issues with Catalina, so I restored macOS Mojave from a Time Machine backup. CotEditor works fine again.

1024jp commented 5 years ago

Thank you for keeping update your state and sorry for that your issue was not solved. Catalina, macOS 10.15.0, is actually really (and unbelievably) unstable. Therefore, it's really hard to determine where the cause is. Maybe, it's better to wait until macOS 10.15.1 or later, and if you still have the problem with the future versions, feel free to let me know. I'll just close this issue once.

crankygeologist commented 4 years ago

I think you're correct in assuming this is an Apple issue. See:

https://discussions.apple.com/thread/250743000

I have Catalina installed on an external drive and will try the following suggestion:

  1. Use an AirPrint or generic PS/PCL printer, not a printer added with vendor drivers; it doesn't need to be real printer
  2. Use "Open in Preview" from the pdf menu in the print dialog
  3. Use Preview, File -> Export as PDF…
  4. Open the PDF in Safari, where Print -> Save as PDF works.

10.15.1 is out and maybe the issue is fixed.

1024jp commented 4 years ago

@crankygeologist Thank you for sharing the information. I hope the new Catalina fixes this.