How to send a pdf file from Node/Express app to the browser

后端 未结 5 2041
悲&欢浪女
悲&欢浪女 2020-12-06 00:06

In my Node/Express app I have the following code, which suppose to read a PDF document from a file, and send it to the browser:

var file = fs.createReadStrea         


        
5条回答
  •  借酒劲吻你
    2020-12-06 00:39

    If you are using the Swagger/OpenAPI then you can look in responses section of below code. /api/pdf_from_html: post: tags: - PDF description: Create PDF from html produces: - application/pdf consumes: - application/json parameters: - name: contents description: HTML content to convert to pdf in: body required: true schema: $ref: "#/definitions/pdf" responses: 200: description: Returns a PDF encoded in base64 content: application/pdf: schema: type: string format: base64

提交回复
热议问题