Skip to main content
Participant
April 5, 2021
Question

Adobe PDF tools in Azure functions

  • April 5, 2021
  • 1 reply
  • 975 views

I am working on an azure function in which I need to convert PDF to Excel. I am using Adobe PDF Tools API for the conversion. The PDF is in my azure storage account I access it using datalake file client and read the content in memory stream. Then I use the API and the code is shown in the picture.

 

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? Thank you in advance

This topic has been closed for replies.

1 reply

Joel Geraci
Community Expert
Community Expert
April 5, 2021

I'm not familiar with C# so I'm just guessing here but I think you can remove GetMediaType() from the line starting with FileRef.

Aneri5F8DAuthor
Participant
April 5, 2021

But according to the documentation, the CreateFromStream method does not work without the GetMediaType() parameter.

Joel Geraci
Community Expert
Community Expert
April 5, 2021

In this sample usage, it doesn't seem to be required... a media type is required but is defined by

ExportPDF.SupportedSourceFormat.pdf

See below.

input = PDFToolsSdk.FileRef.createFromLocalFile('test/resources/PDF.pdf', ExportPDF.SupportedSourceFormat.pdf);