Skip to main content
Participant
Apr 5, 2021 10:47 AM UTC
Question

Adobe PDF tools in Azure functions

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 is closed to new replies. Start a new post to keep the conversation going.

3 replies

Joel Geraci
Community Expert
Community Expert
Apr 5, 2021 3:56 PM UTC

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.

Translate
Aneri5F8DAuthor
Participant
Apr 5, 2021 4:00 PM UTC

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

Translate
Joel Geraci
Community Expert
Community Expert
Apr 5, 2021 4:31 PM UTC

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);

Translate