SelectPdf Html To Pdf

무료
분류별 Tom Williams | 업데이트됨 a month ago | Business
인기

5.3 / 10

지연 시간

276ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

Api writing blank PDF file

Rapid account: Littulb
littulb
il y a 9 ans

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 il y a 9 ans

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”);
}
});

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입