<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fix_pdf(pdf_file, destination):
 """ Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination """

    tmp = tempfile.NamedTemporaryFile()
    with open(tmp.name, 'wb') as output:
        with open(pdf_file, "rb") as fh:
            for line in fh:
                output.write(line)
                if b'%%EOF' in line:
                    break
    shutil.copy(tmp.name, destination)