C-Command Software Forum

Using Webarchive to PDF outside EagleFiler


starting from the AppleScript you provided, I tried to use the functionality to convert webarchives outside EagleFiler to PDFs. Essentially I am calling the cl tool like this:

do shell script “/Applications/EagleFiler/EagleFiler.app/Contents/Frameworks/WashFramework.framework/Resources/efweb2pdf ‘/Users/myusername/Desktop/EagleFilerAppleScripts.webarchive’ ‘/Users/myusername/Desktop/EagleFilerAppleScripts.pdf’ id”

This works, i.e. the PDF is created, but after that the cl tool crashes.

Thread 0 Crashed:
0 com.apple.CoreFoundation 0x9391bd38 TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION + 0
1 libobjc.A.dylib 0x90a134e8 objc_exception_throw + 68
2 com.apple.CoreFoundation 0x9391bc9c +[NSException raise:format:arguments:] + 136
3 com.apple.CoreFoundation 0x9391bcd4 +[NSException raise:format:] + 52
4 com.apple.Foundation 0x94941b3c -[NSCFDictionary setObject:forKey:] + 268
5 efweb2pdf 0x000035a8 -[PDFLoader savePDF:] + 1180
6 efweb2pdf 0x000030e0 main + 356
7 efweb2pdf 0x00002a34 _start + 744
8 efweb2pdf 0x00002744 start + 44

Judging from the additional argument id, there seems to be a side effect, i.e. the tool tries to hand data to EagleFiler or the database or the like, which it does not have. I am not sure though, since your original script does not seem to hand over data to the tool except the source and target paths.

Is there a way to call the tool just for conversion, i.e. without any side effects, or could you change it to make this possible?

BTW, I guess you’d receive a big “Hooray!” if you made this available as a separate command line tool to be included in AppleScripts or Automator Workflows. There are a lot of people out there who would like to get hold of something like this.

It looks like your script should work (and it does, on my Mac). The “id” is included with notifications that the tool posts for EagleFiler, but it’s OK not to listen for them. There may be additional information in the Console log. After it saves the PDF, it adjusts the PDF metadata, and it looks like that’s where the problem is. My guess would be that somehow the page title is nil.

Yes, you were close :wink:

13.06.09 17:04:11 efweb2pdf[15413] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: Author)’

Anything I could do about this?

You should be able to safely ignore the error. I’ll add a workaround to the next version of EagleFiler.

EagleFiler 1.4.7 fixes this crashing bug.