def resolve_all_references(obj, browsed: [], cache: {})
            return obj if browsed.include?(obj)
            browsed.push(obj)

            if obj.is_a?(ObjectStream)
                obj.each do |subobj|
                    resolve_all_references(subobj, browsed: browsed, cache: cache)
                end
            end

            if obj.is_a?(Stream)
                resolve_all_references(obj.dictionary, browsed: browsed, cache: cache)
            end

            if obj.is_a?(CompoundObject)
                obj.update_values! do |subobj|
                    if subobj.is_a?(Reference)
                        subobj = (cache[subobj] ||= subobj.solve.copy)
                        subobj.no = subobj.generation = 0
                        subobj.parent = obj
                    end

                    resolve_all_references(subobj, browsed: browsed, cache: cache)
                end
            end

            obj
        end
def resolve_all_references(obj, browsed: [], cache: {})
            return obj if browsed.include?(obj)
            browsed.push(obj)

            if obj.is_a?(ObjectStream)
                obj.each do |subobj|
                    resolve_all_references(subobj, browsed: browsed, cache: cache)
                end
            end

            if obj.is_a?(Stream)
                resolve_all_references(obj.dictionary, browsed: browsed, cache: cache)
            end

            if obj.is_a?(CompoundObject)
                obj.update_values! do |subobj|
                    if subobj.is_a?(Reference)
                        subobj = (cache[subobj] ||= subobj.solve.copy)
                        subobj.no = subobj.generation = 0
                        subobj.parent = obj
                    end

                    resolve_all_references(subobj, browsed: browsed, cache: cache)
                end
            end

            obj
        end
Replace all references of an object by their actual object value.