This is an archived forum post. The information may be outdated. Contact us if you have any
NODE.js library CORS issue
wrote on 2017-04-03:
I have the following error being returned: `Fetch API cannot load http://pdfcrowd.com/api/pdf/convert/html/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. bundle.js:97 ERROR: TypeError: Failed to fetch`
The code I am using(I have replaced username and key respectively): var pdfcrowd = require('pdfcrowd'); var client = new pdfcrowd.Pdfcrowd(user, key); client.convertHtml('<html>regular HTML code is here</html>', pdfcrowd.saveToFile('download.pdf'));
I read in the forum that CORS was not supported but the post was quite old - this isnt still the case right? If so how am I supposed to use this Node library, currently I am using browserify to use this with a website im putting together
wrote on 2017-04-04:
We do not implement CORS. It is not possible to call the API from a browser, only from a server.