Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Doc theDoc = new Doc(); theDoc.FontSize = 96; theDoc.AddText("Hello World"); theDoc.Save(Server.MapPath("simple.pdf")); theDoc.Clear();
我知道这会创建 pdf 并保存它。当我单击为此创建的链接时,我希望 pdf 仅在 pdf 查看器中弹出,而不是我必须去实际位置查看保存后的样子。我如何让它打开?
您可以在视图中提供指向此文件的链接,以便用户在保存文件后下载该文件:
<a href="@Url.Content("~/simple.pdf")">simple.pdf</a>
如果您希望它在新窗口中打开:
<a href="@Url.Content("~/simple.pdf")" target="_blank">simple.pdf</a>