2017-04-04 111 views
0

我正在使用pdf.js在瀏覽器上查看pdf文檔,並且我想在某個位置添加一個圖像到PDF文檔(如點擊的位置), 那可能嗎?什麼js庫允許我這樣做? 我嘗試使用jsPdf生成一個新的PDF與圖像,但jsPdf不支持使用現有的PDF。如何使用javascript將圖像添加到pdf文檔

回答

-1

注意!將最新的pdf.js庫添加到您的源代碼中。

// load image from local file 
pdf.imageLoadFromUrl('image1.jpg'); 
// place this mage at given X, Y coordinates on the page 
pdf.imagePlace(20, 40); 

來源: PDF.js Inserting Images

+0

我得到這個錯誤:「未捕獲(在承諾)類型錯誤:pdf.imageLoadFromUrl是不是一個函數」 –

+0

確保已包含在最新的pdf.js庫中的碼。 –

+0

請讓我知道,如果這個答案幫助你! –