为Heroku静态编译pdftk。需要将PDF分成单页文件 [英] Statically compile pdftk for Heroku. Need to split PDF into single page files
问题描述
事实证明这比我想象的要困难得多。最初,我下载了ubuntu的软件包( http://packages.ubuntu.com/natty/pdftk ),提取它,并包含二进制文件以及共享库。我遇到了一些奇怪的错误:
未处理的Java异常:
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)
我假设这是因为某些依赖没有安装?
所以,这里是我的问题:
- 是否有更简单的方法来静态编译库?或者我需要移动它的二进制文件以及它的所有库和依赖项?
- 我只是试图在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:
- 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?
- 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屋!