I’m creating PDFs with NewCGPDFDocumentMBS. The code is rather simple:
dim finalPDF as CGContextMBS = newPrintPath.NewCGPDFDocumentMBS(thePDFDoc.MediaBox(1), theSubject.Left(100), theMessageID, App.ApplicationNameMBS)
if finalPDF = nil then
globals.theerrorlog.DialogErrorProceed Replace(kErrorCreate, "<<subject>>", theSubject)
globals.theerrorlog.logitem "print path: " + newPrintPath.NativePath
else
'loop through pages and add header information
end if
One user wants to save the result in Dropbox with Boxcryptor. There the creation of finalPDF fails and finalPDF = nil. In the session log I see:
[quote]2020-02-11, 14:03:10 Dialog: Es gab ein Problem beim Erzeugen des PDFs für den Betreff “Rechnung”.
2020-02-11, 14:03:13 print path: /Volumes/disk name/user name/Boxcryptor/Dropbox (Privat)/_save_data/mail_archive/Local Folders/Archiv/Freizeit/Boot/Mails/Rechnung/Rechnung.pdf[/quote]
Should that work for Boxcryptor? Can I find out why the PDF wasn’t created?
So if the plugin gets a correct URL for the folderitem, we call CGPDFContextCreateWithURL and if that fails, maybe look for a log message in console.app. Or run app in Terminal to see messages.
[quote]Last login: Wed Feb 12 13:01:31 on ttys002
/Applications/Mail\ Archiver\ X/Mail\ Archiver\ X.app/Contents/MacOS/Mail\ Archiver\ X ; exit;
MBP-Thomas:~ thomas$ /Applications/Mail\ Archiver\ X/Mail\ Archiver\ X.app/Contents/MacOS/Mail\ Archiver\ X ; exit;
2020-02-12 13:02:53.183 Mail Archiver X[4454:190050] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.
Feb 12 13:02:54 Mail Archiver X[4454] : MessageTracer: load_domain_whitelist_search_tree:73: Search tree file’s format version number (0) is not supported
Feb 12 13:02:54 Mail Archiver X[4454] : MessageTracer: Falling back to default whitelist
CoreGraphics PDF has logged an error. Set environment variabe “CG_PDF_VERBOSE” to learn more.[/quote]
The user has tried that on his own. But there isn’t anything interesting in the result:
[quote]13:32:48.487558 +0100 Mail Archiver X trackMouse send action on mouseUp
13:33:46.948414 +0100 Mail Archiver X SecKeychainCopyDomainDefault
13:33:46.949048 +0100 Mail Archiver X SecTrustEvaluateIfNecessaryFastAsync
13:33:46.952600 +0100 Mail Archiver X SecKeychainCopyDomainDefault
13:33:46.952786 +0100 Mail Archiver X SecTrustEvaluateIfNecessaryFastAsync
13:33:46.972345 +0100 Mail Archiver X SecTrustReportTLSAnalytics
13:33:51.731316 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:33:51.733086 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:33:51.733862 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:33:51.734007 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:07.750262 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:07.751240 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:07.751857 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:07.752153 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:08.125417 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:08.125743 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:08.126231 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:08.126425 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:08.130988 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:08.131274 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:08.131732 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:08.131935 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:12.638087 +0100 Mail Archiver X trackMouse send action on mouseUp
13:34:12.906234 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:12.907213 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:12.930486 +0100 Mail Archiver X PREPARE_ICON_IMAGE
13:34:12.930672 +0100 Mail Archiver X GET_ICON_IMAGE_NO_IO
13:34:14.726580 +0100 Mail Archiver X trackMouse send action on mouseUp
13:32:40.229521 +0100 Mail Archiver X Retrieve User by ID
/Applications/Mail\ Archiver\ X/Mail\ Archiver\ X.app/Contents/MacOS/Mail\ Archiver\ X ; exit;
MBP-Thomas:~ thomas$ /Applications/Mail\ Archiver\ X/Mail\ Archiver\ X.app/Contents/MacOS/Mail\ Archiver\ X ; exit;
2020-02-12 13:32:57.237 Mail Archiver X[4989:218703] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.
Feb 12 13:32:58 Mail Archiver X[4989] : MessageTracer: load_domain_whitelist_search_tree:73: Search tree file’s format version number (0) is not supported
Feb 12 13:32:58 Mail Archiver X[4989] : MessageTracer: Falling back to default whitelist
CoreGraphics PDF has logged an error. Set environment variabe “CG_PDF_VERBOSE” to learn more.
logout
Saving session…
…copying shared history…
…saving history…truncating history files…
…completed.
Just as an aside… I keep encountering end user systems where temp is missing or read-only.
Not sure what that is about - I have had to add a fall back to use ApplicationData or Documents as a temporary area when I cannot use Temp.
[quote=475669:@Jeff Tullin]Just as an aside… I keep encountering end user systems where temp is missing or read-only.
Not sure what that is about - I have had to add a fall back to use ApplicationData or Documents as a temporary area when I cannot use Temp.[/quote]
Yeah I forgot about that one, you can also try the Caches folder.
Apple actually have API for specifically dealing with atomic file creation, which uses the temporary folder, and it works when I can’t directly access the temporary folder. I keep meaning to clean up my code for it and to share it.
Apple doesn’t document that this API has a glaring bug, whereby it leaves behind an empty folder. That if unremoved, reaches the limit of the number of folders allowed within a folder, and then fails. The folders get auto removed when the system restarts, so my guess is that Apple employees shut their Macs down on a daily basis.
I don’t think so, but with App Wrapper we had to explicitly check and NOT do any processing in a DropBox, iCloud, Google Drive, One Drive folder because the cloud service helper apps get in the way and mess with things while App Wrapper’s doing it’s work.
App Wrapper 4 is in production, and I’ve already compensated for this by moving the application to another location, then working on it, and putting it back when I’m finished.
@Sam Rowlands: something must be different for the file. But I’m going to try with the “create a second temp file and move it to the final location” next.
Yep. Very much this… especially if you have a couple of passes at a file… appending to a PDF, adding a custom icon to a document… these internet file based systems get their claws in halfway through the job and break the process.