I need to convert PDF to Excel as part of a current Azure function that I'm working on. To convert, I'm using the Adobe PDF Tools API. The PDF is in my Azure storage account, and I can read the content in the memory stream using the Data lake file client. I utilize the API after that, and the code is displayed in the image.
await file.ReadToAsync(memoryStream);
Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()
.FromFile("pdftools-api-credentials.json")
.Build();
Adobe.DocumentServices.PDFTools.ExecutionContext executionContext = Adobe.DocumentServices.PDFTools.ExecutionContext.Create(credentials);
ExportPDFOperation exportPdfOperation = ExportPDFOperation.CreateNew(ExportPDFTargetFormat.XLSX);
FileRef sourceFileRef = FileRef.CreateFromStream(memoryStream, ExportPDFOperation.SupportedSourceFormat.PDF.GetMediaType());
exportPdfOperation.SetInput(sourceFileRef);
FileRef result = exportPdfOperation.Execute(executionContext);
Now, when I run this, I get the following error:
"Error response received for the request: An error occurred while sending the request. The response ended prematurely."
The code is in C#.
Can someone please help?