It's not exactly pretty but you could get some idea of the size but just checking the length of the
Document field (though you'd need to know it's not going to blow out your heap space).
There's an answer on StackOverflow which has a method to get an upper bound for the size of a base64 encoded file:
The exact length cannot be calculated unless you look at the padding.
Without looking for padding, the best you can do is calculate an upper
bound for the length by multiplying the encoded-string length with 3/4
(the encoded length is guaranteed to be exactly divisible by 4).
The upper bound calculated thus will be either N, N+1 or N+2, where N
is the length of the raw data.