PDFKit gem 无法隐藏链接 - Rails 3

发布于 2024-12-09 18:04:30 字数 257 浏览 7 评论 0原文


大家好,

我正在按照本教程从我的 Rails 应用程序中的视图生成“pdf”文件。一切都很好,直到我试图隐藏“下载链接”。每次我生成 PDF 文件时,链接仍然显示。我认为 css 文件中的“@media print”样式不起作用。

还有其他方法可以隐藏生成的 pdf 文件中的链接吗?

感谢您的帮助


Hello people

I was following this tutorial to generate a "pdf" file from a view in my rails app. Everything was ok, until I tried to hide the "link to download". Everytime I generate the PDF file, the link is still shown. I think that the "@media print" style in the css file is not working.

Is there another way to hide the link in the generated pdf file?

Thanks for the help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼趣 2024-12-16 18:04:30

此处回答 http://railscasts.com/episodes/220-pdfkit。检查 application.css 部分,

您需要为“下载链接”提供一个 id,然后在 CSS 文件中使用 display: none 隐藏该元素。在上面的示例中,id 名称是 pdf_link,css 属性的定义如下 -

 #pdf_link{ display: none; }

这应该可以工作。

It is answered here http://railscasts.com/episodes/220-pdfkit. Check section application.css

You need to give an id for the "link to download" then in the CSS file hide the element using display: none. In the above example the id name is pdf_link and css properties are defined like this -

 #pdf_link{ display: none; }

That should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文