当前,我正在尝试打开PDF文件进行打印,但出现错误File is not PDF document
。
我使用了以下JS脚本:
$.ajax({
type: "POST",
url: ajaxURL,
data: { order_id: idsss,shipment:1, shipping_method : oshipping_method,delivery_method:favorite},
/*contentType: "application/json; charset=utf-8"*/
}).done(function(data) {
var obj = jQuery.parseJSON(data);
console.log(obj);
$('#myaccount').prepend(obj.scriptname);
if(obj.filenames != "")
{
var splitFiles = obj.filenames.split(',');
$.each(splitFiles, function( index, value ) {javascript:jsWebClientPrint.print('useDefaultPrinter=undefined&printerName=null&filetype=PDF&name='+value);
});
}
});
我还尝试添加内容类型application/json; charset=utf-8
,dataType: "text"
,dataType: "html"
,并且也使用了
xhrFields: {
responseType : 'blob'
},
但仍然无法正常工作。