Recommended way to embed PDF in HTML?

前端 未结 24 1914
天命终不由人
天命终不由人 2020-11-21 04:54

What is the recommended way to embed PDF in HTML?

  • iFrame?
  • Object?
  • Embed?

What does Adobe say itself about it?

In my

24条回答
  •  一向
    一向 (楼主)
    2020-11-21 05:22

    This is the way I did with AXIOS and Vue.js:

            axios({
                url: `urltoPDFfile.pdf`,
                method: 'GET',
                headers: headers,
                responseType: 'blob'
            })
            .then((response) => {
                this.urlPdf = URL.createObjectURL(response.data)
            })
            .catch((error) => {
                console.log('ERROR   ', error)
            })
    

    add urlPDF dynamically to HTML:

    
    

提交回复
热议问题