Ruby on Rails 和大虾PDF

发布于 2024-10-02 18:30:34 字数 315 浏览 0 评论 0原文

我在我的网站上创建了一个 PDF 文档。 一切都很好,但是当我尝试将图像添加到 PDF 中时,我得到了 “我们很抱歉,但有些不对劲。 我们已收到有关此问题的通知,我们会尽快查看。”

因此,Prawn 出现了一些问题。

这就是我尝试的方法 “图像'标志.png” 我尝试了很多方法,都是在互联网上找到的,似乎没有任何作用。 其中之一是 BASEDIR,我怎么知道 BASEDIR 在哪里?

无论如何,我使用 OSX Server 10.6,非常感谢您回答我这些问题

- Prawn 日志文件在哪里? - 如何添加图像

非常感谢, 问候!

Im creating a PDF Document on my Website.
All works just fine, but when i try to add a Image into the PDF i get
"We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly."

So something fails with Prawn.

This is how i try
"image 'logo.png"
i tryed so many ways, all found in the internet, nothing seemed to work.
One was with the BASEDIR, how do i know where BASEDIR is?

Anyway im using OSX Server 10.6 and id be very thankfull to anwser me those questions

-Where is the Prawn Logfile?
-How does one add a Image

Thanks very much,
Greetings!

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

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

发布评论

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

评论(1

烂柯人 2024-10-09 18:30:34

您需要引用该文件的完整路径。

我们通常使用 RAILS_ROOT 作为起点来引用 PDF 中使用的图像。所以我们使用类似的东西:

pdf.image "#{RAILS_ROOT}/public/images/logo-header.png"

假设 pdf 是一个 Prawn::Document 对象。

You'll need to refer to the full path to the file.

We usually refer to our images used in PDFs using the RAILS_ROOT as the starting point. So we use something like:

pdf.image "#{RAILS_ROOT}/public/images/logo-header.png"

Assuming pdf is a Prawn::Document object.

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