在 NodeJS 中使用 PDFMake 下载 PDF 失败,未发出任何事件

问题描述

我想使用 PDFMake 库生成和下载 PDF。我能够在服务器端生成 PDF,但在 from tkinter import * from random import * import time global posJoueur ; global posBut ; global n ; global c ; global score global nbBut ; global gameTime score=0 ; posJoueur=[0,0] ; n=15 ; c=50 '########### #### Gestion des déplacements #################################' def droite(event = None): posJoueur[0]+=50 if posJoueur[0]>700: posJoueur[0]=700 dep_droite() def dep_droite(): c1.delete(ALL) rond= c1.create_oval(posJoueur[0],posJoueur[1],posJoueur[0]+c,posJoueur[1]+c,fill='#fff') jouer() def gauche(event = None): posJoueur[0]-=50 if posJoueur[0]<0: posJoueur[0]=0 dep_gauche() def dep_gauche(): c1.delete(ALL) rond = c1.create_oval(posJoueur[0],fill='#fff') jouer() def bas(event = None): posJoueur[1]+=50 if posJoueur[1]>700: posJoueur[1]=700 dep_bas() def dep_bas(): c1.delete(ALL) rond = c1.create_oval(posJoueur[0],fill='#fff') jouer() def haut(event = None): posJoueur[1]-=50 if posJoueur[1]<0: posJoueur[1]=0 dep_haut() def dep_haut(): c1.delete(ALL) rond = c1.create_oval(posJoueur[0],fill='#fff') jouer() '################# Gestion du jeu #########################################' def commencerJeu(): global score ; global gameTime ; global nbBut ; global posJoueur global posBut nbBut=0 gameTime=[time.time(),0] score=0 posJoueur = [0,0] posBut = [0,0] But() def But(): global nbBut nbBut =nbBut+ 1 posBut[0]=randint(0,14)*50 posBut[1]=randint(0,14)*50 but=c1.create_oval(posBut[0],posBut[1],posBut[0]+c,posBut[1]+c,fill="red") jouer() def jouer(): global score if posJoueur[0]==posBut[0] and posJoueur[1]==posBut[1]: if nbBut==goal.get(): gameTime[1]=time.time() score=round(1/(gameTime[1]-gameTime[0])*1000,2) affichagescore.set("score =" +str(score)) c1.create_text(c*n/2,c*n/2,font="Purisa",text="Jeu terminé !",fill="red") c1.pack() goal.set(goal.get()+1) else: But() '################# programme principale ####################################' f1=Tk() f1.title("Python Game Challenge") f1.bind("<Right>",droite) ; f1.bind("<Left>",gauche) f1.bind("<Down>",bas) ; f1.bind("<Up>",haut) l1 = Label(f1,text="Bienvenu dans mon jeu !") l1.pack(side="top",ipadx=30,ipady=30) affichagescore=StringVar() affichagescore.set("score =00.00") l2 = Label(f1,textvariable=affichagescore) l2.pack(side="right",ipadx=10,ipady=10) b1=Button(f1,text="Jouer",fg='yellow',bg="black",command=commencerJeu) b1.pack(side="left",ipady=10) b2=Button(f1,text="Fermer",command=f1.destroy) b2.pack(side="left",ipady=10) c1=Canvas(f1,width=n*c,height=n*c,bg="black") rond = c1.create_oval(posJoueur[0],fill='#fff') c1.pack() goal = Intvar() goal.set(1) f1.mainloop() 完成后我无法发出下载文件的事件

我有这个控制器

writeStream

使用这个模型

const controller = {
 download: async (req,res) => {
    const { user,query } = req;
    const result = await service.download(user,query);
    res.download(result);
  },}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)