Convert PDF to XML in Python using Aspose.PDF REST API Throws Error 500

asposepdfcloud.rest.ApiException: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Tue, 18 Jan 2022 07:00:00 GMT’, ‘Content-Type’: ‘application/json; charset=utf-8’, ‘Transfer-Encoding’: ‘chunked’, ‘Connection’: ‘keep-alive’, ‘Server’: ‘Kestrel’, ‘Strict-Transport-Security’: ‘max-age=2592000’})
HTTP response body: {“RequestId”:“a05acfb8-85be-40d7-a297-8f4bf8ae2189”,“Error”:{“Code”:“internalError”,“Message”:“The method or operation is not implemented.”,“Description”:“Operation Failed. Internal error.”,“DateTime”:“2022-01-18T07:00:00.525609Z”,“InnerError”:null}}
still receivingthis error

@sneha_baser

Please note, you can convert tagged PDF to XML in Python using the PutXmlInStorageToPdf API method. However, you need to use PutPdfInStorageToMobiXml API method to convert untagged PDF document to MobiXML.

So, if you are trying to convert a tagged PDF to XML using the PutXmlInStorageToPdf API method, then please share your input document with us. We will test the scenario and will guide you.

Convert PDF to XML Python Online

import os
import asposepdfcloud
from asposepdfcloud.apis.pdf_api import PdfApi

# Get App key and App SID from https://cloud.aspose.com
pdf_api_client = asposepdfcloud.api_client.ApiClient('xxxxxxxxxxxxxxxxxxxxxxxxxx','xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx')

pdf_api = PdfApi(pdf_api_client)
filename = '4pages.pdf'
remote_name = '4pages.pdf'
output_file= '4pages.xml'

#upload PDF file to storage
pdf_api.upload_file(remote_name,filename)

#Covert PDF to XML and save in storage
response=pdf_api.put_pdf_in_storage_to_xml(remote_name,output_file)
print(response)