Free Support Forum -

Can't convert local PDF file to HTML

I’m using the REST interface and trying to use the endpoint to convert a PDF file into HTML. I have tried a couple different PDFs but I get the same error message:

Specified argument was out of the range of valid values.

Parameter name: offset

I’m not providing any argument named offset and, based on the operation’s definition, it’s not required. I’m not sure what this is or how to resolve it.

I know it’s processing on some level because if I send a big file, it rejects it saying, “Your pricing plan does not allow files of size XYZ”. What am I doing wrong?


Submitted from:

Hi Nick,

You just need to specify format e.g.

Can you please share your sample files and complete code for further analysis? Sorry for the inconvenience.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team

Hi Muhammad, my request does actually contain the conversion format, I was
just specifying the endpoint free of arguments. I figured out what my
problem was. I've been using NodeJS and its HTTP client library, by
default, is encoding the body of the request for chunking. You can see it
in the request header as "Transfer-Encoding: chunked". It seems the
Saaspose service isn't thrilled about that and gets the error you see
below. To fix this, I simply specified the Content-Length header (which is
mutually exclusive when chunking) in the request and it worked fine. Node
automagically stops encoding for chunking. I'm just letting you know in
case this comes up in the future with someone else.

Here's the piece of code I've developed that shows this in process

signedUrl = @sign("pdf/convert?format=html")

options =
url: signedUrl
headers: {'Content-Length': file.size, 'Content-Type':

stream = fs.createReadStream(file.path).pipe(request.put(options,
(error, response, body) ->
callback(body, response)

Hi Nick,

Good to know that you have resolved this issue and thanks a lot for letting us know how you sorted this issue out.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team