Javascript 如何使用json和pdfmaker
我有一个json对象Javascript 如何使用json和pdfmaker,javascript,angularjs,pdf,Javascript,Angularjs,Pdf,我有一个json对象 [{"agence":"CTM","secteur":"Safi","statutImp":"operationnel"}] 如何将这些数据与pdfmaker一起打印为pdf文件…因为我无法处理json对象,这里有一个演示 [{"agence":"CTM","secteur":"Safi","statutImp":"operationnel"}] var-app=angular.module(“app”,[]); app.controller(“listContr
[{"agence":"CTM","secteur":"Safi","statutImp":"operationnel"}]
如何将这些数据与pdfmaker一起打印为pdf文件…因为我无法处理json对象,这里有一个演示
[{"agence":"CTM","secteur":"Safi","statutImp":"operationnel"}]
var-app=angular.module(“app”,[]);
app.controller(“listController”,[“$scope”,
职能($范围){
$scope.data=[{“代理”:“CTM”、“部门”:“Safi”、“statutImp”:“operationnel”}];
$scope.export=函数(){
html2canvas(document.getElementById('exportthis'){
onrendered:函数(画布){
var data=canvas.toDataURL();
变量定义={
内容:[{
图片:数据,
宽度:500,
}]
};
下载(test.pdf);
}
});
}
}
]);代码>
{{data}}
出口
检查此项:感谢您的回答……但从服务器上,我以json对象的形式获取数据。我如何使用您的示例解决我的问题??您需要用json对象替换示例数据,我有一个json对象…不是一个简单的数据。你可以用我的json数据制作一个plunker来查看它是否工作,但我希望数据作为表格而不是平面文本。你知道怎么做吗???