Knowledge Base and examples

Knowledge Base - PDF file from httpstream always returning -3 error code

If you're willing to render file not relying on the device file system but coming from an online URL you should adopt the http stream methods.
 
You should provide your application the permissions to generate data traffic and, most important, your server should support Accept-Ranges directive and return the Content-lenght information within the response header.
 
Here an example of not working server response:

HTTP/1.1 200 OK
Server: Apache/2.0
Date: Fri, 13 Mar 2015 09:20:36 GMT
Content-type: application/pdf
Last-modified: Fri, 27 Jun 2014 10:24:55 GMT
Content-length: 24024
Etag: W/"5dd8-53ad4677"



Here an example of good server response:


curl -I "http://goodresponseserver.com/demo.pdf"

HTTP/1.1 200 OK
Date: Fri, 13 Mar 2015 09:21:24 GMT
Server: Apache
Last-Modified: Fri, 13 Mar 2015 09:02:36 GMT
ETag: "5dd8-51127c2ff8c74"
Accept-Ranges: bytes
Content-Length: 24024
Content-Type: application/pdf

An example about how to configure Accept-Ranges directives on Apache:
 
Disable Accept-Ranges on pdf files:
<Files *.pdf>
    Header set Accept-Ranges none 
</Files>
Enable Accept-Ranges on pdf files:
<Files *.pdf>
    Header set Accept-Ranges bytes 
</Files>

 

Applies To

All Products

Details

Created : 2015-03-13 10:47:11, Last Modified : 2015-03-13 10:49:51