def METHOD_NAME(self, document_path, file_name):
    pdf_path = os.path.join(self.tempdir, "convert.pdf")
    gotenberg_server = settings.TIKA_GOTENBERG_ENDPOINT
    url = gotenberg_server + "/forms/libreoffice/convert"
    self.log.info(f"Converting {document_path} to PDF as {pdf_path}")
    with open(document_path, "rb") as document_handle:
        files = {
            "files": (
                "convert" + os.path.splitext(document_path)[-1],
                document_handle,
            ),
        }
        headers = {}
        data = {}
        # Set the output format of the resulting PDF
        # Valid inputs: https://gotenberg.dev/docs/modules/pdf-engines#uno
        if settings.OCR_OUTPUT_TYPE in {"pdfa", "pdfa-2"}:
            data["pdfFormat"] = "PDF/A-2b"
        elif settings.OCR_OUTPUT_TYPE == "pdfa-1":
            data["pdfFormat"] = "PDF/A-1a"
        elif settings.OCR_OUTPUT_TYPE == "pdfa-3":
            data["pdfFormat"] = "PDF/A-3b"
        try:
            response = httpx.post(
                url,
                files=files,
                headers=headers,
                data=data,
                timeout=settings.CELERY_TASK_TIME_LIMIT,
            )
            response.raise_for_status()  # ensure we notice bad responses
        except Exception as err:
            raise ParseError(
                f"Error while converting document to PDF: {err}",
            ) from err
    with open(pdf_path, "wb") as file:
        file.write(response.content)
        file.close()
    return pdf_path