javascript - PDF 文件未打开打印给定错误
问题描述
目前,我正在尝试打开 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'
},
但还是不行。
解决方案
推荐阅读
- python - NoReverseMatch at //,未找到“”的反向。“ ”不是有效的视图函数或模式名称
- php - sql数据类型的类型会对sql查询的组成有影响吗?
- r - 从字符串中提取单词
- c# - servertelemetry 通道如何收集 wpf 的数据 - 离线?
- c# - 如何在不实例化新 ViewModel 的情况下设置 BindingContext
- php - 分页不适用于帖子名称固定链接,但适用于普通固定链接
- android - 如何在 Android 的 JUnit 测试中模拟创建 NdefMessage
- android - 无法在 nativescript 中获取我的视图的 android 属性
- excel - 是否可以声明一个不包含与 VBA 中的 With 语句的部分匹配
- erlang - 从 ets 表中删除日期戳超过 10 秒的所有记录