SelectPdf Html To Pdf

БЕЗКОШТОВНО
(Ким) Tom Williams | Оновлено 한 달 전 | Business
Популярність

5.3 / 10

Затримки

276ms

Рівень обслуговування

100%

Health Check

N/A

Повернутися до всіх обговорень

Api writing blank PDF file

Rapid account: Littulb
littulb
9년 전

The api is writing a blank pdf file. This is my code using Node.js

unirest.get(“https://selectpdf-selectpdf-html-to-pdf-v1.p.mashape.com/?key=0d423b5d-cdd6-47bc-bab4-112be88d80a0&html=”+html)
.header(“X-Mashape-Key”, “9oYSCDWU3SmshO6IWVZYpgFxzTC9p1zE7mCjsnsrNSyO9dZIKE”)
.end(function (result) {
console.log(result.status, result.headers);
fs.writeFileSync(“public/Sample.pdf”, result.body);
res.redirect("/");
});

Rapid account: Selectpdf
selectpdf Commented 9년 전

The response body should be binary data. The code should look like this:

unirest.get(“https://selectpdf-selectpdf-html-to-pdf-v1.p.mashape.com/?key=0d423b5d-cdd6-47bc-bab4-112be88d80a0&html=”+html)
.encoding(“binary”)
.header(“X-Mashape-Key”, “9oYSCDWU3SmshO6IWVZYpgFxzTC9p1zE7mCjsnsrNSyO9dZIKE”)
.end(function (result) {
console.log(result.status, result.headers);
if (result.statusCode == 200) {
fs.writeFileSync(“Sample.pdf”, result.body, “binary”);
}
});

Приєднуйтесь до обговорення — додайте повідомлення нижче:

Вхід / Реєстрація, щоб публікувати нові повідомлення