Reversed Arabic text when saving to FileField

I’m using fillpdf library to fill in a PDF form. When save the file normally it works fine. But when I try to save to a FileField the text is reversed.

def _fill_form(self, application):        
        import requests
        from fillpdf import fillpdfs
        from django.core.files import File, base
        from io import BytesIO
        from django.forms.models import model_to_dict

        ctx = {
            'full_name': 'منصور أحمد',
            'current_nationality': 'الإمارات العربية المتحدة'
        }

        response = requests.get("http://localhost:8000/static/document/form.pdf")
        if not response.ok:
            log.error("couldn't get form")

        in_stream = BytesIO(response.content)
        out_stream = BytesIO()

        fillpdfs.write_fillable_pdf(
            in_stream,
            out_stream,
            ctx,
            flatten=True
        )

        with open("output.pdf", "wb") as f:
            f.write(out_stream.getbuffer()) # this saves the file with the right format

        application.arabic_document.save("Some fillpdf file.pdf", base.ContentFile(out_stream.getbuffer())) // this saves the file with reversed Arabic text

The reversed text
Screenshot 2024-05-14 120336