尝试发送带有请求的base64 pdf字符串,但我似乎无法弄清楚请求的正确结构。在此先感谢您的帮助!
var dpdf = pdfvar.toString('base64');
var options = {
method: 'POST',
body: dpdf,
url: FILEPICKER_URL,
headers: [
{
name: 'content-type',
value: 'application/pdf'
}
]
};
request(options, function(err, httpResponse, body){
console.log('body: ', body);
console.log('code ', httpResponse.statusCode)
});
答案 0 :(得分:0)
The other side is expecting a PDF
application/pdf
and not a BASE64 representation of it.
Anyway, looking at what you are trying to do, without necessarily understanding how you are trying to do it... I would try and append a data url compatible header to your string like so :
var dpdf = 'data:application/pdf;base64,' + pdfvar.toString('base64')