function getTextFromDocument(document) {
        var text = document.getText();
        text = filterText(text);
        return text;
    }
Get the text of a document, applying any size restrictions
if necessary
@param {Document} document - the document to get the text from
@return {string} the text, or the empty text if the original was too long