We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert pdf to xml using python

Hi Team I’m trying to convert pdf to xml in python using asposepdf lib. and below code i wrote
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(
app_key=‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’,
app_sid=‘xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxx’)

pdf_api = PdfApi(pdf_api_client)
remote_name = ‘sample.pdf’
output_file= ‘sample.xml’
#upload PDF file to storage
pdf_api.upload_file(remote_name,remote_name)
#Covert PDF to XML and save in Aspose default storage
response = pdf_api.put_pdf_in_storage_to_xml(remote_name,output_file)
#response=pdf_api.put_pdf_in_storage_to_xml(remote_name,output_file)
print(response)

while the above code getting the below error
HTTP response body: {“RequestId”:“a90c8124-08a2-43fb-9a7e-fc333a394e87”,“Error”:{“Code”:“internalError”,“Message”:“Tagged pdf expected. Please use tagged pdf file for converting to xml format or use MobiXml for untagged pdf.”,“Description”:“Operation Failed. Internal error.”,“DateTime”:“2021-09-28T15:39:56.3280544Z”,“InnerError”:null}}

Can anyone help me in this issue.

This topic has been moved to the related forum: https://forum.aspose.cloud/t/convert-pdf-to-xml-using-python/8296