Skip to content

Instantly share code, notes, and snippets.

@blueturtle13g
Created March 28, 2019 15:36
Show Gist options
  • Save blueturtle13g/3c32df4ec69113a88518026f4c78964f to your computer and use it in GitHub Desktop.
Save blueturtle13g/3c32df4ec69113a88518026f4c78964f to your computer and use it in GitHub Desktop.
RdXPpL
// sorry I had a lot of trouble to log in my account in jsfiddle so chose codepen.
const URL = 'https://api.pdflayer.com/api/convert?access_key=63d65d2fdb1bfa11c676e37f275fe22e';
axios.post(URL, {
document_html: `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
hello world
</body>
</html>`,
test: "1"
})
.then(function (response) {
console.log("response: ", response);
// please open your dev tools and you can see the error
// Note: in order to pass 'Access-Control-Allow-Origin' error, I installed this chrome extension: "https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related?hl=en-US"
})
.catch(function (error) {
console.log("err: ", error);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment