public void invalidate() {
        synchronized (documentLock) {
            if (document != null) {
                Page page;
                // quickly invalidate content streams so we can swap font
                // implementations.
                for (int i = 0, max = getDocumentLength(); i < max; i++) {
                    page = document.getPageTree().getPage(i, this);
                    if (page.isInitiated()) {
                        page.getLibrary().disposeFontResources();
                        page.reduceMemory();
                    }
                    document.getPageTree().releasePage(page, this);
                }
                // mark state as dirty
                isStateChanged = true;
            }
        }
    }