如何在不使用javascript的情况下使用php将fabric js canvas json转换为pdf

如何在不使用javascript的情况下使用php将fabric js canvas json转换为pdf,php,canvas,Php,Canvas,我想把画布转换成PDF格式。我想把它写成cron。由于Javascript不能在cron中工作,所以我想在php中工作 画布json对象是 {"objects":[{"type":"text","originX":"center","originY":"center","left":531.22,"top":249,"width":115,"height":31.2,"fill":"e2ddcf","stroke":null,"strokeWidth":5,"strokeDashArray":n

我想把画布转换成PDF格式。我想把它写成cron。由于Javascript不能在cron中工作,所以我想在php中工作

画布json对象是

{"objects":[{"type":"text","originX":"center","originY":"center","left":531.22,"top":249,"width":115,"height":31.2,"fill":"e2ddcf","stroke":null,"strokeWidth":5,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1.14,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","text":"MOJE TŁO","fontSize":24,"fontWeight":"normal","fontFamily":"Times New Roman","fontStyle":"normal","lineHeight":1.3,"textDecoration":"","textAlign":"left","path":null,"textBackgroundColor":"","useNative":true},{"type":"image","originX":"center","originY":"center","left":63,"top":304,"width":66,"height":66,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":340.06,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","src":"src_to_picture","filters":[]}],"background":"cyan","backgroundImage":"src_to_my_picture","backgroundImageOpacity":1,"backgroundImageStretch":true}
请帮忙

编辑:使用jspdf和带有canvas.todataurl的json对象可以轻松完成此操作。但是我想知道没有js怎么做

canvas.loadFromJSON(JSON.parse(jsonobject)
var imgPdfData = canvas.toDataURL("image/jpeg", 1.0);
var pdf=new jsPDF("p", "mm", "a4");
var width = pdf.internal.pageSize.width;    
var height = pdf.internal.pageSize.height;
pdf.addImage(imgPdfData, 'png', 5, 5,width-10,height-10);