Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

請教 PDF 檔案是否支援 圖檔 #434

Answered by hueifeng
Miles1122 asked this question in Q&A
Discussion options

您好:
我想在產生 PDF 檔案的時侯加入公司的 Logo 。
但是目前為止,都試不出來要如何加入,能指導一下嘛?
檔案為本地端的 png or jpg 檔案。
有試過...在 DTO 中加入 [ExportImageField(Width = 50, Height = 120, Alt = "404")] or [ImportImageField]
皆沒有在 PDF 檔案中顯出現來。

You must be logged in to vote

Pdf导出不需要ExportImageField,我们只需要在html模板中定义img标签即可,通过razor语法可以做到,可参考https://github.com/dotnetcore/Magicodes.IE/blob/master/docs/3.基础教程之导出Pdf收据.md

Replies: 1 comment 3 replies

Comment options

Pdf导出不需要ExportImageField,我们只需要在html模板中定义img标签即可,通过razor语法可以做到,可参考https://github.com/dotnetcore/Magicodes.IE/blob/master/docs/3.基础教程之导出Pdf收据.md

You must be logged in to vote
3 replies
Comment options

您好:
您是說...我在 DTO 中不需要加入 [ImportImageField] 對嘛? 然後在 html 模版中 定義 img 即可。
但是我己經是這樣做了...
<p> <h1 align="left">@Model.Data.CompanyTitle</h1> <img src="@Model.Data.CompanyLogo" /> </p>
CompanyLogo 的部份為空白的只有一個小方塊出現,但是上面的 CompanyTitle 是成功顯示的。
而我確定 ComapnyLogo 有本地址的絶對路徑和檔案的 String 值。
但是還是無法在 PDF 檔案中看到圖檔。

Comment options

可以尝试转换成base64显示,如果采用本地地址确实在pdf生成器那边读取不到

Comment options

您好:
依據您的提示...我想法子把 Logo 組成可以在網頁上取得的路徑後..可以顯示了。
慼謝幫忙。

Answer selected by Miles1122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /