Aspose.Pdf-Cloud Converting from pdf to html returns 400 bad request


#1

I’m having trouble using the cloud api to convert pdf to html.

My code:

public byte[] ConvertPdfToHtml(byte[] doc, string fileName)
        {
            var pdfApi = new PdfApi(ConfigurationManager.AppSettings["AsposeKey"],
                ConfigurationManager.AppSettings["AsposeSID"], ConfigurationManager.AppSettings["AsposeUrl"]);

            try
            {
                var apiResponse = pdfApi.PutConvertDocument("html", null,
                    Path.GetFileNameWithoutExtension(fileName) + ".html", doc);

                if (apiResponse != null && apiResponse.Status.Equals("Ok"))
                {
                    return apiResponse.ResponseStream;
                }

                throw new Exception("Couldn't convert pdf - " + fileName + " to HTML...");
            }
            catch (Exception ex)
            {
                NLogger.LogError("ConvertPdfToHtml - " + ex);
                throw;
            }
        }

When making the call, I am noticing this error under the My Usage tab:

Error: The method or operation is not implemented… Method: Convert document to the format specified on-line… Parameters: format ‘html’,url ‘’,outPath ‘testadobe.html’

Thereby, am I calling the method wrong somehow? I’m using the same method on doc/docx with the wordsapi with good results so far…

If the method is indeed not implemented, yet publicly exposed, what I’m after is to get html back with embedded images preferably without using storage, I can’t seem to find an example on google because all the aspose cloud documentation links are returning Page Not Found.


#2

@4TierSoftware,

We can replicate the 400 bad request error in our environment. We are in communication with the concerned team and will let you know once an update is available.


#3

@4TierSoftware

We have two APIs to convert PDF document to HTML .

  1. GET /v{version}/pdf/{name}
  2. PUT /v{version}/pdf/convert

I recommend you to use the first one. The following cURL example will help you to understand an API.

curl -v "http://api.aspose.cloud/v1.1/pdf/Sample.pdf?format=html&appSID=B01A15E5-1B83-4B9A-8EB3-0F2BFA6AC766&signature=hHUw2HKmLY6tQFEevDg52uOLKak" \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: multipart/form-data" \
-o Sample_out.zip 

As you may have observed, I set the output (-o) file extension to .zip, instead of .html, the reason is that the converted file contains multiple files (.html, .css, image files), so API zipped the output file.

P.S. The resource file Sample.pdf and output file Sample_out.zip are attached.

Sample.pdf (360.7 KB)
Sample_out.zip (17.8 KB)