heroku上phantomjs中的页面中断内部支持

编程入门 行业动态 更新时间:2024-10-27 10:18:05
本文介绍了heroku上phantomjs中的页面中断内部支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个使用PhantomJS生成PDF文件的NodeJS应用程序。我的应用程序已部署到Heroku,并使用这个幻像生成包。不幸的是,这个构建包不支持 page-break-inside:避免 CSS属性。

我做了一项调查,并在这个 GitHub问题页面。我已经尝试了他们两个,但不幸的是我不能使用CSS,因为我的页面结构和JavaScript不能正确分页。

上面的GitHub链接中的一个人提到,如果我从源代码编译,这个问题是固定的,但我不知道如何在Heroku App上从源代码编译,甚至可能。我找到的所有buildpack都使用二进制文件。

对于我的应用来说,正确地分页是非常重要的,但是我无法找到让这个功能正常工作的方法。任何有关如何解决我的问题的建议/指南将不胜感激!

7.6.0),并使用这个指南编译PhantomJS。 所以我执行了: pre $ sudo apt-get update $ b $ sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev libxft-dev git clone git://github/ariya/phantomjs.git cd phantomjs git checkout 1.9 ./ build.sh

然后我从 / bin 文件夹并将其添加到自定义buildpack。我将这个buildpack添加到了heroku中,但它崩溃,出现以下错误: $ p $ / phantomjs:/usr/lib/libstdc++.so .6:未找到'GLIBCXX_3.4.15'版本(需要./phantomjs)

在我的机器上

ldd bin / phantomjs

并且我接受了所有依赖关系:

root @ deepsypotato:/ home / viktor#ldd phantomjs.1 linux-vdso.so.1 => (0x00007fffe9f74000) libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6(0x00007fd914fcd000) libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1(0x00007fd914d96000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2(0x00007fd914b91000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1(0x00007fd914989000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0(0x00007fd91476d000) libstdc ++。so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6(0x00007fd914465000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6(0x00007fd9141e3000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1(0x00007fd913fcd000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6(0x00007fd913c41000) /lib64/ld-linux-x86-64.so.2(0x00007fd915283000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1(0x00007fd913a2a000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1(0x00007fd913800000)

然后我复制 libstdc ++。so.6 从 / usr / lib / x86_64-linux-gnu / libstdc ++。so.6 并添加了它到我的定制buildpack,现在它的工作完美无缺:)。

I have a NodeJS app using PhantomJS to generate PDF files. My app is deployed to Heroku and I'm using this phantom build pack. Unfortunately this build pack does not support the page-break-inside: avoid CSS property.

I did a research and found 2 hacks on this GitHub issue page. I've tried both of them, but unfortunately I can't use the CSS one, due to my page structure and the JavaScript one isn't page-breaking properly.

One of the guys in the GitHub link above mentioned that this problem is fixed if I compile from source, but I have no idea how I can compile from source on Heroku App and is it even possible. All the buildpacks I found are using the binaries.

It's really important for my app to break pages properly, but I can't find a way to get this feature working. Any suggestion/guide about how to fix my issue will be greatly appreciated!

解决方案

I've downloaded it to my machine(Debian 7.6.0) and compiled PhantomJS using this guide. So I executed:

sudo apt-get update sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev libxft-dev git clone git://github/ariya/phantomjs.git cd phantomjs git checkout 1.9 ./build.sh

And then I took the binary from /bin folder and added it to custom buildpack. I added this buildpack to heroku, but it crashed with the following error:

/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./phantomjs)

So I did on my machine

ldd bin/phantomjs

and I took all dependencies:

root@deepsypotato:/home/viktor# ldd phantomjs.1 linux-vdso.so.1 => (0x00007fffe9f74000) libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fd914fcd000) libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fd914d96000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd914b91000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd914989000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd91476d000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd914465000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd9141e3000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd913fcd000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd913c41000) /lib64/ld-linux-x86-64.so.2 (0x00007fd915283000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd913a2a000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fd913800000)

then I copied libstdc++.so.6 from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 and added it to my custom buildpack and now its working flawlessly :).

更多推荐

heroku上phantomjs中的页面中断内部支持

本文发布于:2023-10-13 09:32:42,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   heroku   phantomjs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!