-
-
Notifications
You must be signed in to change notification settings - Fork 496
-
您好:
我想在產生 PDF 檔案的時侯加入公司的 Logo 。
但是目前為止,都試不出來要如何加入,能指導一下嘛?
檔案為本地端的 png or jpg 檔案。
有試過...在 DTO 中加入 [ExportImageField(Width = 50, Height = 120, Alt = "404")] or [ImportImageField]
皆沒有在 PDF 檔案中顯出現來。
Beta Was this translation helpful? Give feedback.
All reactions
Pdf导出不需要ExportImageField,我们只需要在html模板中定义img标签即可,通过razor语法可以做到,可参考https://github.com/dotnetcore/Magicodes.IE/blob/master/docs/3.基础教程之导出Pdf收据.md
Replies: 1 comment 3 replies
-
Pdf导出不需要ExportImageField,我们只需要在html模板中定义img标签即可,通过razor语法可以做到,可参考https://github.com/dotnetcore/Magicodes.IE/blob/master/docs/3.基础教程之导出Pdf收据.md
Beta Was this translation helpful? Give feedback.
All reactions
-
您好:
您是說...我在 DTO 中不需要加入 [ImportImageField] 對嘛? 然後在 html 模版中 定義 img 即可。
但是我己經是這樣做了...
<p> <h1 align="left">@Model.Data.CompanyTitle</h1> <img src="@Model.Data.CompanyLogo" /> </p>
CompanyLogo 的部份為空白的只有一個小方塊出現,但是上面的 CompanyTitle 是成功顯示的。
而我確定 ComapnyLogo 有本地址的絶對路徑和檔案的 String 值。
但是還是無法在 PDF 檔案中看到圖檔。
Beta Was this translation helpful? Give feedback.
All reactions
-
可以尝试转换成base64显示,如果采用本地地址确实在pdf生成器那边读取不到
Beta Was this translation helpful? Give feedback.
All reactions
-
您好:
依據您的提示...我想法子把 Logo 組成可以在網頁上取得的路徑後..可以顯示了。
慼謝幫忙。
Beta Was this translation helpful? Give feedback.