def __init__(self, filename=None, stream=None, filetype=None, rect=None, width=<NUM_LIT:0>, height=<NUM_LIT:0>, fontsize=<NUM_LIT:11>):
if not filename or type(filename) is str:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if fitz_py2:  <EOL><INDENT>if type(filename) is unicode:<EOL><INDENT>filename = filename.encode("<STR_LIT:utf8>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>filename = str(filename)  <EOL><DEDENT><DEDENT>if stream:<EOL><INDENT>if not (filename or filetype):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if type(stream) is bytes:<EOL><INDENT>self.stream = stream<EOL><DEDENT>elif type(stream) is bytearray:<EOL><INDENT>self.stream = bytes(stream)<EOL><DEDENT>elif type(stream) is io.BytesIO:<EOL><INDENT>self.stream = stream.getvalue()<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>stream = self.stream<EOL><DEDENT>else:<EOL><INDENT>self.stream = None<EOL><DEDENT>if filename and not stream:<EOL><INDENT>self.name = filename<EOL><DEDENT>else:<EOL><INDENT>self.name = "<STR_LIT>"<EOL><DEDENT>self.isClosed    = False<EOL>self.isEncrypted = <NUM_LIT:0><EOL>self.metadata    = None<EOL>self.openErrCode = <NUM_LIT:0><EOL>self.openErrMsg  = '<STR_LIT>'<EOL>self.FontInfos   = []<EOL>self.Graftmaps   = {}<EOL>self.ShownPages  = {}<EOL>self._page_refs  = weakref.WeakValueDictionary()<EOL>this = _fitz.new_Document(filename, stream, filetype, rect, width, height, fontsize)<EOL>try:<EOL><INDENT>self.this.append(this)<EOL><DEDENT>except __builtin__.Exception:<EOL><INDENT>self.this = this<EOL><DEDENT>if this:<EOL><INDENT>self.openErrCode = self._getGCTXerrcode()<EOL>self.openErrMsg  = self._getGCTXerrmsg()<EOL>self.thisown = True<EOL>self._graft_id = TOOLS.gen_id()<EOL>if self.needsPass:<EOL><INDENT>self.isEncrypted = <NUM_LIT:1><EOL><DEDENT>else: <EOL><INDENT>self.initData()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.thisown = False<EOL><DEDENT>
__init__(self, filename=None, stream=None, filetype=None, rect=None, width=0, height=0, fontsize=11) -> Document