Hello Patrick!
Thanks for the suggestion!
I tried the code you provided but sadly ContentHelper.getPrimary(doc); returns null.
So I played about with the API a little further and finally I got it to work using below code:
ObjectReference or = ObjectReference.newObjectReference(doc);
ContentItem contentItem = ContentHelper.service.getPrimaryContent(or);
if (contentItem instanceof ApplicationData) { // as opposed to ExternalData or URLData
sizeInKb = ((ApplicationData) contentItem).getFileSizeKB();
}
Cheers!
/Peter