def output(self, name='<STR_LIT>',dest='<STR_LIT>'):
<EOL>if(self.state<<NUM_LIT:3>):<EOL><INDENT>self.close()<EOL><DEDENT>dest=dest.upper()<EOL>if(dest=='<STR_LIT>'):<EOL><INDENT>if(name=='<STR_LIT>'):<EOL><INDENT>name='<STR_LIT>'<EOL>dest='<STR_LIT:I>'<EOL><DEDENT>else:<EOL><INDENT>dest='<STR_LIT:F>'<EOL><DEDENT><DEDENT>if dest=='<STR_LIT:I>':<EOL><INDENT>print(self.buffer)<EOL><DEDENT>elif dest=='<STR_LIT:D>':<EOL><INDENT>print(self.buffer)<EOL><DEDENT>elif dest=='<STR_LIT:F>':<EOL><INDENT>f=open(name,'<STR_LIT:wb>')<EOL>if(not f):<EOL><INDENT>self.error('<STR_LIT>'+name)<EOL><DEDENT>if PY3K:<EOL><INDENT>f.write(self.buffer.encode("<STR_LIT>"))<EOL><DEDENT>else:<EOL><INDENT>f.write(self.buffer)<EOL><DEDENT>f.close()<EOL><DEDENT>elif dest=='<STR_LIT:S>':<EOL><INDENT>return self.buffer<EOL><DEDENT>else:<EOL><INDENT>self.error('<STR_LIT>'+dest)<EOL><DEDENT>return '<STR_LIT>'<EOL>
Output PDF to some destination