Rails pdftk 错误

发布于 2024-10-14 01:14:00 字数 201 浏览 4 评论 0原文

我在 Rails 应用程序中使用 pdftk 来生成多个单独 pdf 文件的复合 pdf。无论出于何种原因,当 pdftk 未生成复合文件时,不会生成错误。我确实将此代码区域封装在 begin/rescue 块中,但由于我使用 %x[...] 执行 pdftk,因此它不会收到来自外部调用的任何异常。我怎样才能 a) 调用 pdftk 来捕获异常或 b) 从 %x 调用接收输出错误代码?

I'm using pdftk within my rails application to generate a composite pdf of several individual pdf files. When, for whatever reason, pdftk does not generate the composite file, no error is generated. I do have this area of code wrapped in a begin/rescue block, but since i'm using %x[...] to execute pdftk, it doesn't receive any exeptions from the external call. How can i either a) call pdftk where i can capture the exception or b) receive the output error code from the %x call?

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

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

发布评论

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

评论(1

不乱于心 2024-10-21 01:14:00
`pdftk #{subcommand}`
raise Exception unless $?.success?
`pdftk #{subcommand}`
raise Exception unless $?.success?
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文