为Heroku静态编译pdftk。需要将PDF分成单页文件 [英] Statically compile pdftk for Heroku. Need to split PDF into single page files

查看:124
本文介绍了为Heroku静态编译pdftk。需要将PDF分成单页文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我们使用heroku来托管我们的rails应用程序。我们已经转移到雪松堆栈。该堆栈没有安装pdftk库。我联系了支持人员,并被告知要为amd64 ubuntu进行静态编译,并将其包含在我的应用程序中。



事实证明这比我想象的要困难得多。最初,我下载了ubuntu的软件包( http://packages.ubuntu.com/natty/pdftk ),提取它,并包含二进制文件以及共享库。我遇到了一些奇怪的错误:

 未处理的Java异常:
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfCopy.copyIndi​​rect(pdftk)
at com.lowagie.text.pdf.PdfCopy.copyObject(pdftk)
at com.lowagie.text.pdf.PdfCopy.copyDictionary( pdftk)

我假设这是因为某些依赖没有安装?



所以,这里是我的问题:




  1. 是否有更简单的方法来静态编译库?或者我需要移动它的二进制文件以及它的所有库和依赖项?

  2. 我只是试图在ruby中将多页PDF分割成单页文件。有没有办法做到这一点没有PDFTK?或者我坚持尝试静态编译PDFTK?

感谢您的帮助,我知道这不是一个简单的问题,但真的会很感激这个帮助。我已经浪费了近6个小时,试图让这件该死的东西起作用。

灵活性。因此,感觉越来越像我以前管理和维护自己的服务器的日子。没有简单的解决方案。我的猴子补丁是将文件发送到服务器,我可以安装PDFTK,处理文件并将其发回。不是很好,但它有效。不得不处理这个问题,这就违背了使用heroku的目的。


So we're using heroku to host our rails application. We've moved to the cedar stack. This stack does not have the pdftk library installed. I contacted support and was told to statically compile it for amd64 ubuntu and include it in my application.

This has proved more difficult than I thought. Initially I downloaded the package for ubuntu (http://packages.ubuntu.com/natty/pdftk), extracted it, and included the binary file as well as the shared libraries. I'm getting strange errors like:

Unhandled Java Exception:
java.lang.NullPointerException
   at com.lowagie.text.pdf.PdfCopy.copyIndirect(pdftk)
   at com.lowagie.text.pdf.PdfCopy.copyObject(pdftk)
   at com.lowagie.text.pdf.PdfCopy.copyDictionary(pdftk)

I'm assuming this is because some of the dependencies aren't installed?

So here are my questions:

  1. Is there an easier way to statically compile a library? Or do I need to move over its binary file as well as all of its libraries and dependencies?
  2. I'm just trying to split a multi-page PDF into single page files in ruby. Is there a way to do this without PDFTK? Or am I stuck with trying to statically compile PDFTK?

Thanks for the help, I know this isn't an easy problem, but would really appreciate help with this one. I've wasted close to 6 hours trying to get this damn thing to work.

解决方案

Unfortunately Heroku keeps stripping out magic to add flexibility. As a result it feels more and more like the days when I used to manage and maintain my own servers. There is no easy solution. My "monkey patch" is to send the file to a server that I can install PDFTK, process the file, and send it back. Not great, but it works. Having to deal with this defeats the purpose of using heroku.

这篇关于为Heroku静态编译pdftk。需要将PDF分成单页文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆