iT邦幫忙

0

ASP.NET CORE MVC 顯示PDF Form

Jay 2022-10-28 13:16:341073 瀏覽
  • 分享至 

  • xImage

各位大神們好,
想請教一下mvc是否可以做到以下的功能?
1.在網頁上顯示PDF Form
2.讓使用者填寫PDF Form,並且簽名(必須是e-signature)
3.將使用者填寫好的PDF Form存檔到伺服器的文件夾裡

目前我使用iframe顯示pdf form,在網頁上也可以填寫,但是form裡面的簽名欄位並沒有顯示出來,然後也無法將填好的pdf存至server。
iframe自帶的功能只能存到本地的電腦裡。
請各位大大指點~謝謝

https://ithelp.ithome.com.tw/upload/images/20221028/20145331fgm52SocMB.png

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
純真的人
iT邦大師 1 級 ‧ 2022-10-28 20:27:44

嗯...因為我習慣只看原始碼在寫...而且是VB語系~跟你C#語系不一樣吧~
所以你就參考看看我的圖片解說@@

首先要在Server產生~先去網路下載一個wkhtmltopdf.exe元件,放到Bin資料夾~
https://ithelp.ithome.com.tw/upload/images/20221028/2006136995JDdlq5a4.png

然後我的簽名文件是用signature_pad.js互動~所以你要用的話也是去網路找來下載~我是放在JS資料夾~
https://ithelp.ithome.com.tw/upload/images/20221028/20061369pCs9JsuTsv.png

JS程式碼用法如下~
1.引用signature_pad.js
https://ithelp.ithome.com.tw/upload/images/20221028/20061369AXWdmKuiY3.png

2.設定canvas畫布
https://ithelp.ithome.com.tw/upload/images/20221028/20061369Mjd7SUfIYX.png

3.搜索所有canvas標籤,套用signature_pad
https://ithelp.ithome.com.tw/upload/images/20221028/20061369doY3qxHvBl.png

4.將簽名檔的資料送到Server上面記錄簽名檔,並產生PDF記錄到Server上面存放~
https://ithelp.ithome.com.tw/upload/images/20221028/200613694bS3majNy8.png

5.這頁是要生成PDF的網頁(可直接瀏覽網頁~先看有無排版錯誤),把記錄在Server上的簽名檔呼叫出來~在網頁中顯示~
https://ithelp.ithome.com.tw/upload/images/20221028/20061369CFz6VMZjxc.png

這是簽名檔資料~直接放到img標籤就好~
https://ithelp.ithome.com.tw/upload/images/20221028/20061369vJWmiTcgCG.png

我要發表回答

立即登入回答